Commit Graph

164 Commits (d5c086697896d87f034c1dbe0ae0ccbc71f37d2c)

Author SHA1 Message Date
Roland Kovacs d962e06e91
Add runtime language configuration (#1794) (#1866)
* Add runtime language configuration (#1794)

* Add set-language typable command to change the language of current buffer.
* Add completer for available language options.

* Update set-language to refresh language server as well

* Add language id based config lookup on `syntax::Loader`.
* Add `Document::set_language3` to set programming language based on language
  id.
* Update `Editor::refresh_language_server` to try language detection only if
  language is not already set.

* Remove language detection from Editor::refresh_language_server

* Move document language detection to where the scratch buffer is saved.
* Rename Document::set_language3 to Document::set_language_by_language_id.

* Remove unnecessary clone in completers::language
2 years ago
Blaž Hrastnik c18de0e8f0
fix: Don't rely on FormattingOptions::default()
Refs #1884
2 years ago
Skyler Hawthorne a494f47a5d
Configurable auto pairs (#1624)
* impl auto pairs config

Implements configuration for which pairs of tokens get auto completed.

In order to help with this, the logic for when *not* to auto complete
has been generalized from a specific hardcoded list of characters to
simply testing if the next/prev char is alphanumeric.

It is possible to configure a global list of pairs as well as at the
language level. The language config will take precedence over the
global config.

* rename AutoPair -> Pair

* clean up insert_char command

* remove Rc

* remove some explicit cloning with another impl

* fix lint

* review comments

* global auto-pairs = false takes precedence over language settings

* make clippy happy

* print out editor config on startup

* move auto pairs accessor into Document

* rearrange auto pair doc comment

* use pattern in Froms
2 years ago
Blaž Hrastnik a449156702 Extract a lsp position helper 2 years ago
Gokul Soumya 59b5bf3178 Refactor document methods 2 years ago
Blaž Hrastnik e2d2f19fd0
Merge pull request #1154 from sudormrfbin/cursor-shape-new
Change cursor shape on mode change
2 years ago
Blaž Hrastnik 4080341977 cargo fmt + clippy lint 2 years ago
Blaž Hrastnik 53d881f172 Store theme scopes on the loader, this way theme isn't passed around 2 years ago
Blaž Hrastnik 6728e44490 syntax: Split parsing and highlighting 2 years ago
Kevin Sjöberg 3a34036310
Use the correct language ID for JavaScript & TypeScript (#1466)
* Use correct language ID for JavaScript/TypeScript

* Add missing slash

* Only calculate fallback when needed
2 years ago
Gokul Soumya 449624965b Merge branch 'master' into cursor-shape-new 3 years ago
Matouš Dzivjak 4b0b1a5657
feat(ui): file encoding in statusline (#1355)
* feat(ui): file encoding in statusline

Display file encoding in statusline if the encoding
isn't UTF-8.

* Re-export encoding_rs from core

From there it can be imported by other mods
that rely on it.
3 years ago
WindSoilder 600ce70cf6
Improve dedent behavior (#1232)
* tmp add code for dedent

* finish normal_mode with dedent behavior

* use function pointer

* rebase from origin

* check dedent condition inside normal_mode implementation

* using if let...

* fix check

* using char_is_whitespace instead of ch.is_whitespace

* fix clippy

* abstract restore_indent function
3 years ago
Gokul Soumya d4fb1d0633 Merge branch 'master' into cursor-shape-new 3 years ago
Gokul Soumya 016640f4fb Remove ui.cursor.primary and hashmap lookups 3 years ago
Ivan Tham e2b428cc2d
Add last modified file (gm) (#1093) 3 years ago
ath3 35c974c9c4
Implement "Goto last modification" command (#1067) 3 years ago
Cole Helbling b824e091a9
helix-term/commands: move SCRATCH_BUFFER_NAME to helix-view/document (#1091)
This way, the name is accessible everywhere `Document` and related types
are.
3 years ago
Ivan Tham 9d591427be
Fix earlier/later missing changeset update (#1069)
Fix #1059
3 years ago
Blaž Hrastnik 549cdee561 Refactor shebang detection to reuse the loaded buffer 3 years ago
ath3 77dbbc73f9
Detect filetype from shebang line (#1001) 3 years ago
Blaž Hrastnik e80708eba7 Make sure document diagnostics are sorted 3 years ago
Omnikar 51b4d35dce
Inform when reaching undo/redo bounds (#981)
* Inform when reaching undo/redo bounds

* `Already at oldest change` when undo fails
* `Already at newest change` when redo fails

* Add missing `the`
3 years ago
Kirawi cec0cfdaec
Uncomment mapping LSP diagnostics through changes (#925) 3 years ago
Blaž Hrastnik c1e5831b21 set_path: Pass in the function directly 3 years ago
Blaž Hrastnik 3e69a4852e Simplify set_path 3 years ago
Omnikar e2ed691537
Implement `hx --tutor` and `:tutor` to load `tutor.txt` (#898)
* Implement `hx --tutor` and `:tutor` to load `tutor.txt`

* Document `hx --tutor` and `:tutor`

* Change `Document::set_path` to take an `Option`

* `Document::set_path` accepts an `Option<&Path>` instead of `&Path`.
* Remove `Editor::open_tutor` and make tutor-open functionality use
  `Editor::open` and `Document::set_path`.

* Use `PathBuf::join`

Co-authored-by: Ivan Tham <pickfire@riseup.net>

* Add comments explaining unsetting tutor path

Co-authored-by: Ivan Tham <pickfire@riseup.net>
3 years ago
Blaž Hrastnik e36ad8b4ed minor: Further simplify take_with 3 years ago
Blaž Hrastnik 3edca7854e completion: fully revert state before apply & insertText common prefix 3 years ago
Blaž Hrastnik c913bade0a fix: Indentation used different default on `hx` vs `hx new_file.txt` 3 years ago
Blaž Hrastnik 0b1bc566e4 fix: lsp: Regression with textDocument/didSave not getting sent 3 years ago
Blaž Hrastnik 64099af3f1 Don't panic on save if language_server isn't initialized 3 years ago
Blaž Hrastnik 37606bad47 lsp: doc.language_server() is None until initialize completes 3 years ago
Blaž Hrastnik 10b690b5bd Drop some &mut bounds where & would have sufficed 3 years ago
Blaž Hrastnik 800d79b584 ls: Refactor textDocument/didSave in a similar vein 3 years ago
Blaž Hrastnik 184637c55a lsp: refactor format so we stop cloning the language_server 3 years ago
Blaž Hrastnik 57ed5180e0 lsp: Improve line ending handling when generating TextEdit 3 years ago
Brian Shu fa4caf7e3d remove unsafe 3 years ago
Kirawi b99db7c687
Move path util functions from helix-term to helix-core (#650) 3 years ago
Blaž Hrastnik 1d45f50781 fix: Don't internally use relative paths in the buffer picker
Fixes #619
3 years ago
Kirawi 16bf8e1e6b
Document more of document.rs (#562) 3 years ago
Gokul Soumya d84f8b5fde
Show file preview in split pane in fuzzy finder (#534)
* Add preview pane for fuzzy finder

* Fix picker preview lag by caching

* Add picker preview for document symbols

* Cache picker preview per document instead of view

* Use line instead of range for preview doc

* Add picker preview for buffer picker

* Fix render bug and refactor picker

* Refactor picker preview rendering

* Split picker and preview and compose

The current selected item is cloned on every event, which is
undesirable

* Refactor out clones in previewed picker

* Retrieve doc from editor if possible in filepicker

* Disable syntax highlight for picker preview

Files already loaded in memory have syntax highlighting enabled

* Ignore directory symlinks in file picker

* Cleanup unnecessary pubs and derives

* Remove unnecessary highlight from file picker

* Reorganize buffer rendering

* Use normal picker for code actions

* Remove unnecessary generics and trait impls

* Remove prepare_for_render and make render mutable

* Skip picker preview if screen small, less padding
3 years ago
Blaž Hrastnik f0eb6ed96a Resolve a couple TODOs 3 years ago
Blaž Hrastnik 557c63033c fix: Map all selections on transaction.apply 3 years ago
Nathan Vegdahl f88d4c1e20 Move indent-style code into `helix_core::indent`. 3 years ago
Nathan Vegdahl e191a75e33 Give default document a single line ending. 3 years ago
Nathan Vegdahl cd7302ffd3 Enforce cursor/selection invariants in one place.
Rather than per-command like before.
3 years ago
Nathan Vegdahl 43594049dd Merge branch 'master' into great_line_ending_and_cursor_range_cleanup 3 years ago
Shafkath Shuhan 25103833b2 mark reloaded buffers as unchanged 3 years ago
Nathan Vegdahl 198fe40951 Don't insert a final line ending on file load/reload. 3 years ago