From 1373ae07bc06f4094de952591506931e125e90df Mon Sep 17 00:00:00 2001 From: Pascal Kuthe Date: Thu, 16 Feb 2023 01:46:18 +0100 Subject: [PATCH 01/24] Remove text bg from monokai (#6009) --- runtime/themes/monokai.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/themes/monokai.toml b/runtime/themes/monokai.toml index b75912f7..a4917cc1 100644 --- a/runtime/themes/monokai.toml +++ b/runtime/themes/monokai.toml @@ -78,7 +78,7 @@ "ui.statusline" = { fg = "active_text", bg = "#414339" } "ui.statusline.inactive" = { fg = "active_text", bg = "#75715e" } -"ui.text" = { fg = "text", bg = "background" } +"ui.text" = { fg = "text" } "ui.text.focus" = { fg = "active_text" } "warning" = { fg = "#cca700" } From 4c85f4d151b8cf3f548d2c35ab6d2eaebe328283 Mon Sep 17 00:00:00 2001 From: LeoniePhiline <22329650+LeoniePhiline@users.noreply.github.com> Date: Thu, 16 Feb 2023 01:47:34 +0100 Subject: [PATCH 02/24] Add `.env.dist` to `source.env` language scope (#6003) --- languages.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages.toml b/languages.toml index eaf73b41..b521cd12 100644 --- a/languages.toml +++ b/languages.toml @@ -2007,7 +2007,7 @@ source = { git = "https://github.com/hh9527/tree-sitter-wit", rev = "c917790ab9a [[language]] name = "env" scope = "source.env" -file-types = [".env", ".env.local", ".env.development", ".env.production", ".envrc"] +file-types = [".env", ".env.local", ".env.development", ".env.production", ".env.dist", ".envrc"] injection-regex = "env" comment-token = "#" indent = { tab-width = 4, unit = "\t" } From d8526a752c52e73f041f76869c0e040959632927 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Wed, 15 Feb 2023 19:15:25 -0600 Subject: [PATCH 03/24] Use Popup::ignore_escape_key helper for completion (#6006) The completion component has a separate branch for handling the Escape key but it can use the `ignore_escape_key` helper added for signature-help instead. This should not cause a behavior change - it's just cleaning up the completion component. --- helix-term/src/ui/completion.rs | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/helix-term/src/ui/completion.rs b/helix-term/src/ui/completion.rs index 3e2f2aea..a24da20a 100644 --- a/helix-term/src/ui/completion.rs +++ b/helix-term/src/ui/completion.rs @@ -9,11 +9,7 @@ use tui::{buffer::Buffer as Surface, text::Span}; use std::borrow::Cow; use helix_core::{Change, Transaction}; -use helix_view::{ - graphics::Rect, - input::{KeyCode, KeyEvent}, - Document, Editor, -}; +use helix_view::{graphics::Rect, Document, Editor}; use crate::commands; use crate::ui::{menu, Markdown, Menu, Popup, PromptEvent}; @@ -254,7 +250,9 @@ impl Completion { } }; }); - let popup = Popup::new(Self::ID, menu).with_scrollbar(false); + let popup = Popup::new(Self::ID, menu) + .with_scrollbar(false) + .ignore_escape_key(true); let mut completion = Self { popup, start_offset, @@ -378,13 +376,6 @@ impl Completion { impl Component for Completion { fn handle_event(&mut self, event: &Event, cx: &mut Context) -> EventResult { - // let the Editor handle Esc instead - if let Event::Key(KeyEvent { - code: KeyCode::Esc, .. - }) = event - { - return EventResult::Ignored(None); - } self.popup.handle_event(event, cx) } From 0f64f31d8b89c24910208bc50baa8ce03c00fbf3 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Wed, 15 Feb 2023 19:16:25 -0600 Subject: [PATCH 04/24] LSP: Add request ID to request timeout message (#6010) This improves error logging for requests - without the ID it's hard to know which request is the one that timed out. --- helix-lsp/src/client.rs | 4 ++-- helix-lsp/src/jsonrpc.rs | 10 ++++++++++ helix-lsp/src/lib.rs | 4 ++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/helix-lsp/src/client.rs b/helix-lsp/src/client.rs index 46772dd2..3f88b352 100644 --- a/helix-lsp/src/client.rs +++ b/helix-lsp/src/client.rs @@ -201,7 +201,7 @@ impl Client { let request = jsonrpc::MethodCall { jsonrpc: Some(jsonrpc::Version::V2), - id, + id: id.clone(), method: R::METHOD.to_string(), params: Self::value_into_params(params), }; @@ -218,7 +218,7 @@ impl Client { // TODO: delay other calls until initialize success timeout(Duration::from_secs(timeout_secs), rx.recv()) .await - .map_err(|_| Error::Timeout)? // return Timeout + .map_err(|_| Error::Timeout(id))? // return Timeout .ok_or(Error::StreamClosed)? } } diff --git a/helix-lsp/src/jsonrpc.rs b/helix-lsp/src/jsonrpc.rs index 69d02707..f415dde0 100644 --- a/helix-lsp/src/jsonrpc.rs +++ b/helix-lsp/src/jsonrpc.rs @@ -108,6 +108,16 @@ pub enum Id { Str(String), } +impl std::fmt::Display for Id { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Id::Null => f.write_str("null"), + Id::Num(num) => write!(f, "{}", num), + Id::Str(string) => f.write_str(string), + } + } +} + /// Protocol Version #[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)] pub enum Version { diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs index 72456b37..341d4a54 100644 --- a/helix-lsp/src/lib.rs +++ b/helix-lsp/src/lib.rs @@ -34,8 +34,8 @@ pub enum Error { Parse(#[from] serde_json::Error), #[error("IO Error: {0}")] IO(#[from] std::io::Error), - #[error("request timed out")] - Timeout, + #[error("request {0} timed out")] + Timeout(jsonrpc::Id), #[error("server closed the stream")] StreamClosed, #[error("Unhandled")] From c332b16855c72beaf0297ad1d5768ed83a768792 Mon Sep 17 00:00:00 2001 From: Pascal Kuthe Date: Thu, 16 Feb 2023 02:16:51 +0100 Subject: [PATCH 05/24] ignore case while filtering completions (#6008) --- helix-term/src/ui/menu.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helix-term/src/ui/menu.rs b/helix-term/src/ui/menu.rs index 8aa10c08..30625ace 100644 --- a/helix-term/src/ui/menu.rs +++ b/helix-term/src/ui/menu.rs @@ -79,7 +79,7 @@ impl Menu { Self { options, editor_data, - matcher: Box::default(), + matcher: Box::new(Matcher::default().ignore_case()), matches, cursor: None, widths: Vec::new(), From 9368ac76b36f430cd127658d9e66b169053c9626 Mon Sep 17 00:00:00 2001 From: Jonathan LEI Date: Thu, 16 Feb 2023 13:17:18 +0800 Subject: [PATCH 06/24] Ignore invalid file URIs from LSP (#6000) --- helix-term/src/application.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index a1685fcf..c8e8ecb1 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -703,7 +703,13 @@ impl Application { } } Notification::PublishDiagnostics(mut params) => { - let path = params.uri.to_file_path().unwrap(); + let path = match params.uri.to_file_path() { + Ok(path) => path, + Err(_) => { + log::error!("Unsupported file URI: {}", params.uri); + return; + } + }; let doc = self.editor.document_by_path_mut(&path); if let Some(doc) = doc { From b7fb52d0e4dff13bab07ff081ec86808e265466f Mon Sep 17 00:00:00 2001 From: Erasin Date: Thu, 16 Feb 2023 22:33:54 +0800 Subject: [PATCH 07/24] fix: decode lsp url for workspace_diagnostics_picker (#6016) --- helix-term/src/commands/lsp.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/helix-term/src/commands/lsp.rs b/helix-term/src/commands/lsp.rs index d1fb32a8..3b94c9bd 100644 --- a/helix-term/src/commands/lsp.rs +++ b/helix-term/src/commands/lsp.rs @@ -145,7 +145,8 @@ impl ui::menu::Item for PickerDiagnostic { let path = match format { DiagnosticsFormat::HideSourcePath => String::new(), DiagnosticsFormat::ShowSourcePath => { - let path = path::get_truncated_path(self.url.path()); + let file_path = self.url.to_file_path().unwrap(); + let path = path::get_truncated_path(file_path); format!("{}: ", path.to_string_lossy()) } }; From d27e808fb3565d59b3082e4ce0bc8e381a03e16e Mon Sep 17 00:00:00 2001 From: workingj <19818596+workingj@users.noreply.github.com> Date: Thu, 16 Feb 2023 15:45:43 +0100 Subject: [PATCH 08/24] feat(theme) ajust pop-dark and clean up gutter linehlght (#5992) --- runtime/themes/pop-dark.toml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/runtime/themes/pop-dark.toml b/runtime/themes/pop-dark.toml index 2ee55903..57db2d2c 100644 --- a/runtime/themes/pop-dark.toml +++ b/runtime/themes/pop-dark.toml @@ -8,13 +8,13 @@ info = { fg = 'yellowH', bg = 'brownD' } hint = { fg = 'brownD', bg = 'yellowH', modifiers = ['bold'] } warning = { fg = 'brownD', bg = 'orangeW', modifiers = ['bold'] } error = { fg = 'brownD', bg = 'redE', modifiers = ['bold'] } -"diagnostic.info".underline = { color = "yellowH", style = "curl" } -"diagnostic.hint".underline = { color = "yellowH", style = "curl" } -"diagnostic.warning".underline = { color = "orangeW", style = "curl" } -"diagnostic.error".underline = { color = "redE", style = "curl" } +'diagnostic.info'.underline = { color = 'yellowH', style = 'curl' } +'diagnostic.hint'.underline = { color = 'yellowH', style = 'curl' } +'diagnostic.warning'.underline = { color = 'orangeW', style = 'curl' } +'diagnostic.error'.underline = { color = 'redE', style = 'curl' } 'ui.background' = { bg = 'brownN' } -'ui.window' = { bg = 'brownH', fg = "brownD" } -'ui.gutter' = { bg = 'brownH' } +'ui.window' = { bg = 'brownH', fg = 'brownD' } +'ui.gutter' = { bg = 'brownU' } 'ui.text' = { fg = 'greyT' } 'ui.text.focus' = { fg = 'orangeN' } 'ui.text.info' = { fg = 'orangeH', bg = 'brownH' } @@ -25,18 +25,18 @@ error = { fg = 'brownD', bg = 'redE', modifiers = ['bold'] } 'ui.cursor.primary' = { fg = 'black', bg = 'orangeN' } 'ui.selection' = { bg = 'blueH', fg = 'white' } 'ui.selection.primary' = { bg = 'blueD', fg = 'white' } -'ui.linenr' = { bg = "brownN", fg = 'greyL' } -'ui.linenr.selected' = { bg = 'brownH', fg = 'orangeH' } -'ui.cursorline' = { bg = 'brownD' } -'ui.statusline' = { fg = "greyT", bg = 'brownH' } -'ui.statusline.inactive' = { fg = "greyT", bg = 'brownN' } -'ui.help' = { fg = "greyT", bg = 'brownD' } +'ui.linenr' = { bg = 'brownU', fg = 'greyL' } +'ui.linenr.selected' = { fg = 'orangeH' } +'ui.cursorline' = { bg = 'brownH' } +'ui.statusline' = { fg = 'greyT', bg = 'brownD' } +'ui.statusline.inactive' = { fg = 'greyT', bg = 'brownN' } +'ui.help' = { fg = 'greyT', bg = 'brownD' } 'ui.highlight' = { bg = 'brownH' } 'ui.virtual' = { fg = 'brownV' } 'ui.virtual.ruler' = { bg = 'brownR' } 'ui.virtual.whitespace' = { fg = 'brownV' } 'ui.virtual.indent-guide' = { fg = 'brownR' } -'ui.menu' = { fg = "greyT", bg = 'brownD' } +'ui.menu' = { fg = 'greyT', bg = 'brownD' } 'ui.menu.selected' = { fg = 'orangeH', bg = 'brownH' } 'ui.popup' = { bg = 'brownD' } 'ui.popup.info' = { bg = 'brownH', fg = 'greyT' } @@ -103,7 +103,7 @@ namespace = { fg = 'orangeL' } 'markup.list.unnumbered' = { fg = 'greenN' } 'markup.bold' = { modifiers = ['bold'] } 'markup.italic' = { modifiers = ['italic'] } -"markup.strikethrough" = { modifiers = ["crossed_out"] } +'markup.strikethrough' = { modifiers = ['crossed_out'] } 'markup.link' = { fg = 'blueD' } 'markup.link.url' = { fg = 'blueL' } 'markup.link.label' = { fg = 'blueH' } @@ -151,8 +151,8 @@ blueL = '#6dd2fa' blueN = '#39B7C7' blueD = '#4AAAD6' brownV = '#67634F' -brownH = '#56524E' -brownN = '#3F3B39' +brownH = '#4b4845' +brownN = '#3E3B39' brownR = '#35312f' brownD = '#2B2928' - +brownU = '#4C4643' From a1a6d5f3340ba8a587bbf8c178fe65589f36a51a Mon Sep 17 00:00:00 2001 From: Triton171 Date: Thu, 16 Feb 2023 15:47:59 +0100 Subject: [PATCH 09/24] Replace incorrect usages of tab_width with indent_width. (#5918) --- helix-core/src/indent.rs | 39 +++++++++++++++++++++++++++++++------- helix-core/tests/indent.rs | 6 ++++-- helix-term/src/commands.rs | 19 ++++++------------- helix-view/src/document.rs | 7 ++++++- 4 files changed, 48 insertions(+), 23 deletions(-) diff --git a/helix-core/src/indent.rs b/helix-core/src/indent.rs index 3aa59fa3..950a7f65 100644 --- a/helix-core/src/indent.rs +++ b/helix-core/src/indent.rs @@ -56,6 +56,14 @@ impl IndentStyle { } } } + + #[inline] + pub fn indent_width(&self, tab_width: usize) -> usize { + match *self { + IndentStyle::Tabs => tab_width, + IndentStyle::Spaces(width) => width as usize, + } + } } /// Attempts to detect the indentation style used in a document. @@ -177,7 +185,7 @@ pub fn auto_detect_indent_style(document_text: &Rope) -> Option { /// To determine indentation of a newly inserted line, figure out the indentation at the last col /// of the previous line. -pub fn indent_level_for_line(line: RopeSlice, tab_width: usize) -> usize { +pub fn indent_level_for_line(line: RopeSlice, tab_width: usize, indent_width: usize) -> usize { let mut len = 0; for ch in line.chars() { match ch { @@ -187,7 +195,7 @@ pub fn indent_level_for_line(line: RopeSlice, tab_width: usize) -> usize { } } - len / tab_width + len / indent_width } /// Computes for node and all ancestors whether they are the first node on their line. @@ -466,6 +474,7 @@ fn extend_nodes<'a>( text: RopeSlice, line: usize, tab_width: usize, + indent_width: usize, ) { let mut stop_extend = false; @@ -490,10 +499,12 @@ fn extend_nodes<'a>( if deepest_preceding.end_position().row == line { extend_node = true; } else { - let cursor_indent = indent_level_for_line(text.line(line), tab_width); + let cursor_indent = + indent_level_for_line(text.line(line), tab_width, indent_width); let node_indent = indent_level_for_line( text.line(deepest_preceding.start_position().row), tab_width, + indent_width, ); if cursor_indent > node_indent { extend_node = true; @@ -562,6 +573,7 @@ pub fn treesitter_indent_for_pos( syntax: &Syntax, indent_style: &IndentStyle, tab_width: usize, + indent_width: usize, text: RopeSlice, line: usize, pos: usize, @@ -622,6 +634,7 @@ pub fn treesitter_indent_for_pos( text, line, tab_width, + indent_width, ); } let mut first_in_line = get_first_in_line(node, new_line.then_some(byte_pos)); @@ -709,6 +722,7 @@ pub fn indent_for_newline( line_before_end_pos: usize, current_line: usize, ) -> String { + let indent_width = indent_style.indent_width(tab_width); if let (Some(query), Some(syntax)) = ( language_config.and_then(|config| config.indent_query()), syntax, @@ -718,6 +732,7 @@ pub fn indent_for_newline( syntax, indent_style, tab_width, + indent_width, text, line_before, line_before_end_pos, @@ -726,7 +741,7 @@ pub fn indent_for_newline( return indent; }; } - let indent_level = indent_level_for_line(text.line(current_line), tab_width); + let indent_level = indent_level_for_line(text.line(current_line), tab_width, indent_width); indent_style.as_str().repeat(indent_level) } @@ -763,12 +778,22 @@ mod test { #[test] fn test_indent_level() { let tab_width = 4; + let indent_width = 4; let line = Rope::from(" fn new"); // 8 spaces - assert_eq!(indent_level_for_line(line.slice(..), tab_width), 2); + assert_eq!( + indent_level_for_line(line.slice(..), tab_width, indent_width), + 2 + ); let line = Rope::from("\t\t\tfn new"); // 3 tabs - assert_eq!(indent_level_for_line(line.slice(..), tab_width), 3); + assert_eq!( + indent_level_for_line(line.slice(..), tab_width, indent_width), + 3 + ); // mixed indentation let line = Rope::from("\t \tfn new"); // 1 tab, 4 spaces, tab - assert_eq!(indent_level_for_line(line.slice(..), tab_width), 3); + assert_eq!( + indent_level_for_line(line.slice(..), tab_width, indent_width), + 3 + ); } } diff --git a/helix-core/tests/indent.rs b/helix-core/tests/indent.rs index f74b576a..b3c543d6 100644 --- a/helix-core/tests/indent.rs +++ b/helix-core/tests/indent.rs @@ -46,11 +46,13 @@ fn test_treesitter_indent(file_name: &str, lang_scope: &str) { for i in 0..doc.len_lines() { let line = text.line(i); if let Some(pos) = helix_core::find_first_non_whitespace_char(line) { + let tab_and_indent_width: usize = 4; let suggested_indent = treesitter_indent_for_pos( indent_query, &syntax, - &IndentStyle::Spaces(4), - 4, + &IndentStyle::Spaces(tab_and_indent_width as u8), + tab_and_indent_width, + tab_and_indent_width, text, i, text.line_to_char(i) + pos, diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index a3c9f0b4..fb55ca2a 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -3364,8 +3364,8 @@ pub mod insert { let count = cx.count(); let (view, doc) = current_ref!(cx.editor); let text = doc.text().slice(..); - let indent_unit = doc.indent_style.as_str(); - let tab_size = doc.tab_width(); + let tab_width = doc.tab_width(); + let indent_width = doc.indent_width(); let auto_pairs = doc.auto_pairs(cx.editor); let transaction = @@ -3386,18 +3386,11 @@ pub mod insert { None, ) } else { - let unit_len = indent_unit.chars().count(); - // NOTE: indent_unit always contains 'only spaces' or 'only tab' according to `IndentStyle` definition. - let unit_size = if indent_unit.starts_with('\t') { - tab_size * unit_len - } else { - unit_len - }; let width: usize = fragment .chars() .map(|ch| { if ch == '\t' { - tab_size + tab_width } else { // it can be none if it still meet control characters other than '\t' // here just set the width to 1 (or some value better?). @@ -3405,9 +3398,9 @@ pub mod insert { } }) .sum(); - let mut drop = width % unit_size; // round down to nearest unit + let mut drop = width % indent_width; // round down to nearest unit if drop == 0 { - drop = unit_size + drop = indent_width }; // if it's already at a unit, consume a whole unit let mut chars = fragment.chars().rev(); let mut start = pos; @@ -3949,7 +3942,7 @@ fn unindent(cx: &mut Context) { let lines = get_lines(doc, view.id); let mut changes = Vec::with_capacity(lines.len()); let tab_width = doc.tab_width(); - let indent_width = count * tab_width; + let indent_width = count * doc.indent_width(); for line_idx in lines { let line = doc.text().line(line_idx); diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index 11a0dbf8..bbcc8666 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -1122,13 +1122,18 @@ impl Document { self.syntax.as_ref() } - /// Tab size in columns. + /// The width that the tab character is rendered at pub fn tab_width(&self) -> usize { self.language_config() .and_then(|config| config.indent.as_ref()) .map_or(4, |config| config.tab_width) // fallback to 4 columns } + // The width (in spaces) of a level of indentation. + pub fn indent_width(&self) -> usize { + self.indent_style.indent_width(self.tab_width()) + } + pub fn changes(&self) -> &ChangeSet { &self.changes } From 78a1e2db6035b326d7536fbd0fb60f9fc586d978 Mon Sep 17 00:00:00 2001 From: Guillaume Date: Thu, 16 Feb 2023 15:48:35 +0100 Subject: [PATCH 10/24] feat: show current language when no argument is provided (#5895) --- book/src/generated/typable-cmd.md | 2 +- helix-term/src/commands/typed.rs | 12 ++++++++++-- helix-term/src/ui/statusline.rs | 3 ++- helix-view/src/document.rs | 2 ++ 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/book/src/generated/typable-cmd.md b/book/src/generated/typable-cmd.md index 7416ac32..ab36997c 100644 --- a/book/src/generated/typable-cmd.md +++ b/book/src/generated/typable-cmd.md @@ -59,7 +59,7 @@ | `:hsplit-new`, `:hnew` | Open a scratch buffer in a horizontal split. | | `:tutor` | Open the tutorial. | | `:goto`, `:g` | Goto line number. | -| `:set-language`, `:lang` | Set the language of current buffer. | +| `:set-language`, `:lang` | Set the language of current buffer (show current language if no value specified). | | `:set-option`, `:set` | Set a config option at runtime.
For example to disable smart case search, use `:set search.smart-case false`. | | `:toggle-option`, `:toggle` | Toggle a boolean config option at runtime.
For example to toggle smart case search, use `:toggle search.smart-case`. | | `:get-option`, `:get` | Get the current value of a config option. | diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 6b45b005..b0fd18a7 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -6,6 +6,7 @@ use crate::job::Job; use super::*; use helix_core::encoding; +use helix_view::document::DEFAULT_LANGUAGE_NAME; use helix_view::editor::{Action, CloseError, ConfigEvent}; use serde_json::Value; use ui::completers::{self, Completer}; @@ -1697,13 +1698,20 @@ fn language( return Ok(()); } + if args.is_empty() { + let doc = doc!(cx.editor); + let language = &doc.language_name().unwrap_or(DEFAULT_LANGUAGE_NAME); + cx.editor.set_status(language.to_string()); + return Ok(()); + } + if args.len() != 1 { anyhow::bail!("Bad arguments. Usage: `:set-language language`"); } let doc = doc_mut!(cx.editor); - if args[0] == "text" { + if args[0] == DEFAULT_LANGUAGE_NAME { doc.set_language(None, None) } else { doc.set_language_by_language_id(&args[0], cx.editor.syn_loader.clone())?; @@ -2414,7 +2422,7 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ TypableCommand { name: "set-language", aliases: &["lang"], - doc: "Set the language of current buffer.", + doc: "Set the language of current buffer (show current language if no value specified).", fun: language, completer: Some(completers::language), }, diff --git a/helix-term/src/ui/statusline.rs b/helix-term/src/ui/statusline.rs index dbb513f8..3e7065b8 100644 --- a/helix-term/src/ui/statusline.rs +++ b/helix-term/src/ui/statusline.rs @@ -1,5 +1,6 @@ use helix_core::{coords_at_pos, encoding, Position}; use helix_lsp::lsp::DiagnosticSeverity; +use helix_view::document::DEFAULT_LANGUAGE_NAME; use helix_view::{ document::{Mode, SCRATCH_BUFFER_NAME}, graphics::Rect, @@ -405,7 +406,7 @@ fn render_file_type(context: &mut RenderContext, write: F) where F: Fn(&mut RenderContext, String, Option