aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui
Commit message (Collapse)AuthorAge
* Reformat with nightly rustfmt for better let-else formatting (#7721)Philipp Mildenberger2023-07-27
|
* highlighted_code_block: Take input text as &strMichael Davis2023-07-27
| | | | | | This removes a handful of allocations for functions calling into the function, which is nice because the prompt may call this function on every keypress.
* Prefer RopeSlice to &Rope in helix_core::syntaxMichael Davis2023-07-27
| | | | | | | | | | | | | | | Pascal and I discussed this and we think it's generally better to take a 'RopeSlice' rather than a '&Rope'. The code block rendering function in the markdown component module is a good example for how this can be useful: we can remove an allocation of a rope and instead directly turn a '&str' into a 'RopeSlice' which is very cheap. A change to prefer 'RopeSlice' to '&Rope' whenever the rope isn't modified would be nice, but it would be a very large diff (around 500+ 500-). Starting off with just the syntax functions seems like a nice middle-ground, and we can remove a Rope allocation because of it. Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>
* Tune regex highlights for usage in promptsMichael Davis2023-07-27
| | | | | | | | | | | Since regex is almost always injected into other languages, `pattern_character`s will inherit the highlight for the structure that injects them (for example `/foo/` in JavaScript or `~r/foo/` in Elixir). This removes the string highlight when used in the prompt. We also add `ERROR` node highlighting so that errors in regex syntax appear in the prompt. This resolves a TODO in the `regex_prompt` function about highlighting errors in the regex.
* Syntax-highlight regex promptsMichael Davis2023-07-27
| | | | | | | | | | | We can use tree-sitter-regex highlighting in prompts for entering regexes, like `search` or `global_search`. The `highlighted_code_block` function from the markdown component makes this a very small change. This could be improved in the future by leaving the parsed syntax tree on the prompt, allowing incremental updates. Prompt lines are usually so short though and tree-sitter-regex is rather small and uncomplicated, so that improvement probably wouldn't make a big difference.
* Save an undo checkpoint before accepting completion (#7747)Michael Davis2023-07-27
|
* Clear statusline while prompt is visible (#7646)Pascal Kuthe2023-07-17
|
* Fix crash when cwd is deleted (#7185)Yomain2023-07-11
|
* make TS matching fallback to plaintextPascal Kuthe2023-06-22
|
* Fix Component implementations for Picker (#7382)Michael Davis2023-06-19
|
* Completely remove old Picker and rename FilePicker to PickerGokul Soumya2023-06-18
|
* Make file preview callback optionalMichael Davis2023-06-18
| | | | | | | When Picker and FilePicker are merged, not all Pickers will be able to show a preview. Co-authored-by: Gokul Soumya <gokulps15@gmail.com>
* Move FilePicker struct def closer to impl blockGokul Soumya2023-06-18
|
* Render the preview in FilePickerGokul Soumya2023-06-18
|
* Move Picker::render into FilePicker::renderGokul Soumya2023-06-18
|
* Move Component methods except render() to FilePickerGokul Soumya2023-06-18
|
* Move handle_event methods from Picker to FilePickerGokul Soumya2023-06-18
|
* Move navigation methods from Picker to FilePickerGokul Soumya2023-06-18
|
* Move scoring functions from Picker to FilePickerGokul Soumya2023-06-18
|
* Copy struct fields and new() from Picker to FilePickerGokul Soumya2023-06-18
|
* Move FilePicker::render from Component impl to normal implGokul Soumya2023-06-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merges the code for the Picker and FilePicker into a single Picker that can show a file preview if a preview callback is provided. This change was mainly made to facilitate refactoring out a simple skeleton of a picker that does not do any filtering to be reused in a normal Picker and a DynamicPicker (see #5714; in particular [mikes-comment] and [gokuls-comment]). The crux of the issue is that a picker maintains a list of predefined options (eg. list of files in the directory) and (re-)filters them every time the picker prompt changes, while a dynamic picker (eg. interactive global search, #4687) recalculates the full list of options on every prompt change. Using a filtering picker to drive a dynamic picker hence does duplicate work of filtering thousands of matches for no reason. It could also cause problems like interfering with the regex pattern in the global search. I tried to directly extract a PickerBase to be reused in Picker and FilePicker and DynamicPicker, but the problem is that DynamicPicker is actually a DynamicFilePicker (i.e. it can preview file contents) which means we would need PickerBase, Picker, FilePicker, DynamicPicker and DynamicFilePicker and then another way of sharing the previewing code between a FilePicker and a DynamicFilePicker. By merging Picker and FilePicker into Picker, we only need PickerBase, Picker and DynamicPicker. [gokuls-comment]: https://github.com/helix-editor/helix/issues/5714#issuecomment-1410949578 [mikes-comment]: https://github.com/helix-editor/helix/issues/5714#issuecomment-1407451963
* Fix underflow when repeating a completion that has a negative shift position ↵Philipp Mildenberger2023-06-12
| | | | (#7322)
* add config option for instant completion entry preview (defaulting to true).Luca Schlecker2023-06-09
| | | | Signed-off-by: Luca Schlecker <luca.schlecker@hotmail.com>
* Add register statusline element (#7222)spectre2562023-06-08
|
* Persist register selection in pending keymapsMichael Davis2023-06-07
| | | | | | | | | | | | | | Previously the register selection (via `"`) would be lost in the middle of any key sequence longer than one key. For example, `<space>f` would clear the register selection after the `<space>` making it inaccessible for the `file_picker` command. This behavior does not currently have any effect in the default keymap but might affect custom keymaps. This change aligns the behavior of the register with count. Making this change allows propagating the register to the `command_palette` (see the child commit) or other pickers should we decide to use registers in those in the future. (Interactive global search for example.)
* Update diagnostics correctly on LSP exit (#7111)Poliorcetics2023-05-23
| | | | | | | * chore: avoid format! call with argument when useless * feat: also clear diagnostics for unopened documents when exiting an LSP * feat: we already worked on `self.editor.diagnostics` no need to redo the checks
* Rebase cleanup/fixes and use lsp::CompletionItem in item_to_transaction directlyPhilipp Mildenberger2023-05-18
|
* Apply all review suggestions (doc_id -> id, error message, unnecessary if)Philipp Mildenberger2023-05-18
| | | | Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>
* Add function `Editor::language_server_by_id` and refactor/simplify related ↵Philipp Mildenberger2023-05-18
| | | | code, also don't 'crash' in completion menu if language_server somehow disappeared
* Filter language servers also by capabilities in ↵Philipp Mildenberger2023-05-18
| | | | | | | | | `doc.language_servers_with_feature` * Add `helix_lsp::client::Client::supports_feature(&self, LanguageServerFeature)` * Extend `doc.language_servers_with_feature` to use this method as filter as well * Add macro `language_server_with_feature!` to reduce boilerplate for non-mergeable language server requests (like goto-definition) * Refactored most of the `find_map` code to use the either the macro or filter directly via `doc.language_servers_with_feature`
* Remove offset_encoding in CompletionItemPhilipp Mildenberger2023-05-18
|
* Refactored doc.language_servers and doc.language_servers_with_feature to ↵Philipp Mildenberger2023-05-18
| | | | | | return an iterator and refactor LanguageServerFeature handling to a HashMap (language server name maps to features) Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>
* Fix sorting issues of the editor wide diagnostics and apply diagnostics ↵Philipp Mildenberger2023-05-18
| | | | | | related review suggestions Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>
* Remove unnecessary completion support check (likely an artifact)Philipp Mildenberger2023-05-18
|
* Adds support for multiple language servers per language.Philipp Mildenberger2023-05-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Language Servers are now configured in a separate table in `languages.toml`: ```toml [langauge-server.mylang-lsp] command = "mylang-lsp" args = ["--stdio"] config = { provideFormatter = true } [language-server.efm-lsp-prettier] command = "efm-langserver" [language-server.efm-lsp-prettier.config] documentFormatting = true languages = { typescript = [ { formatCommand ="prettier --stdin-filepath ${INPUT}", formatStdin = true } ] } ``` The language server for a language is configured like this (`typescript-language-server` is configured by default): ```toml [[language]] name = "typescript" language-servers = [ { name = "efm-lsp-prettier", only-features = [ "format" ] }, "typescript-language-server" ] ``` or equivalent: ```toml [[language]] name = "typescript" language-servers = [ { name = "typescript-language-server", except-features = [ "format" ] }, "efm-lsp-prettier" ] ``` Each requested LSP feature is priorized in the order of the `language-servers` array. For example the first `goto-definition` supported language server (in this case `typescript-language-server`) will be taken for the relevant LSP request (command `goto_definition`). If no `except-features` or `only-features` is given all features for the language server are enabled, as long as the language server supports these. If it doesn't the next language server which supports the feature is tried. The list of supported features are: - `format` - `goto-definition` - `goto-declaration` - `goto-type-definition` - `goto-reference` - `goto-implementation` - `signature-help` - `hover` - `document-highlight` - `completion` - `code-action` - `workspace-command` - `document-symbols` - `workspace-symbols` - `diagnostics` - `rename-symbol` - `inlay-hints` Another side-effect/difference that comes with this PR, is that only one language server instance is started if different languages use the same language server.
* automatically disable TS when parsing takes longer than 500msPascal Kuthe2023-05-18
|
* async picker syntax highlightingPascal Kuthe2023-05-18
|
* clarify comments about completion savepointsPascal Kuthe2023-05-18
| | | | Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* only resolve completion items oncePascal Kuthe2023-05-18
|
* resolve completions before applying transactionsPascal Kuthe2023-05-18
|
* correctly handle completion rerequestPascal Kuthe2023-05-18
|
* Fix warnings from clippy (#7013)ZJPzjp2023-05-11
| | | | | * Fix warnings from clippy * revert MAIN_SEPARATOR_STR
* inject language based on file extension & shebang (#3970)Timothy DeHerrera2023-04-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * inject language based on file extension Nodes can now be captured with "injection.filename". If this capture contains a valid file extension known to Helix, then the content will be highlighted as that language. * inject language by shebang Nodes can now be captured with "injection.shebang". If this capture contains a valid shebang line known to Helix, then the content will be highlighted as the language the shebang calls for. * add documentation for language injection * nix: fix highlights The `@` is now highlighted properly on either side of the function arg. Also, extending the phases with `buildPhase = prev.buildPhase + ''''` is now highlighted properly. Fix highlighting of `''$` style escapes (requires tree-sitter-nix bump) Fix `inherit` highlighting. * simplify injection_for_match Split out injection pair logic into its own method to make the overall flow easier to follow. Also transform the top-level function into a method on a HighlightConfiguration. * markdown: add shebang injection query
* Fix #6669: Theme preview doesn't return theme to normal (#6694)shem2023-04-12
| | | | | * Fix #6669: Theme preview doesn't return theme to normal when delete name with Alt-Backspace * Fix #6669: Return theme preview to normal theme for all remaining keybinds that change the promt text
* Fix typos (#6643)Daniel Sedlak2023-04-07
|
* robustly handle invalid LSP ranges (#6512)Pascal Kuthe2023-04-03
|
* Hide signature help if it overlays completion menu (#5523)Pascal Kuthe2023-03-31
|
* Truncate paths in the file picker (#6410)mWalrus2023-03-31
|
* feat(debug): highlight current line (#5957)Filip Dutescu2023-03-29
| | | | | | | | | | | | | | | | | | Add new theme highlight keys, for setting the colour of the breakpoint character and the current line at which execution has been paused at. The two new keys are `ui.highlight.frameline` and `ui.debug.breakpoint`. Highlight according to those keys, both the line at which debugging is paused at and the breakpoint indicator. Add an indicator for the current line at which execution is paused at, themed by the `ui.debug.active` theme scope. Update various themes to showcase how the new functionality works. Better icons are dependent on #2869, and as such will be handled in the future, once it lands. Closes: #5952 Signed-off-by: Filip Dutescu <filip.dutescu@gmail.com>
* do not ignore mouse scrolling when on top of virtual textPascal Kuthe2023-03-27
|