Commit Graph

3948 Commits (5627c604effd36a4ecd319518e9315e34cfbb0be)
 

Author SHA1 Message Date
Blaž Hrastnik 433ccef3fc
Make nil the preferred language server over rnix-lsp 2 years ago
ChrHorn 322e957ea1
Remove prefix filtering from autocomplete menu (#4578)
PR #4134 switched the autocomplete menu from alphabetical to fuzzy
sorting. This commit removes the still existing filtering by prefix and
should enable full fuzzy sorting of the autocomplete menu.

closes #3084, #1807

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2 years ago
kristopherbullinger 7483c76222
update `x_offset` calculation in Buffer::set_string_truncated (#3839)
when `truncate_start` is `true`, the `x_offset` is now properly updated
according to the width of the content or the truncated length.
2 years ago
Michael Davis 94346356e7
Use TreeCursor to pretty-print :tree-sitter-subtree (#4606)
The current `:tree-sitter-subtree` has a bug for field-names when the
field name belongs to an unnamed child node. Take this ruby example:

    def self.method_name
      true
    end

The subtree given by tree-sitter-cli is:

    (singleton_method [2, 0] - [4, 3]
      object: (self [2, 4] - [2, 8])
      name: (identifier [2, 9] - [2, 20])
      body: (body_statement [3, 2] - [3, 6]
        (true [3, 2] - [3, 6])))

But the `:tree-sitter-subtree` output was

    (singleton_method
      object: (self)
      body: (identifier)
      (body_statement (true)))

The `singleton_method` rule defines the `name` and `body` fields in an
unnamed helper rule `_method_rest` and the old implementation of
`pretty_print_tree_impl` would pass the `field_name` down from the
named `singleton_method` node.

To fix it we switch to the [TreeCursor] API which is recommended by
the tree-sitter docs for traversing the tree. `TreeCursor::field_name`
accurately determines the field name for the current cursor position
even when the node is unnamed.

[TreeCursor]: https://docs.rs/tree-sitter/0.20.9/tree_sitter/struct.TreeCursor.html
2 years ago
Michael Davis c6b83368b3
Capture word parts while calculating shellwords (#4632)
This fixes an edge case for completing shellwords. With a file
"a b.txt" in the current directory, the sequence `:open a\<tab>`
will result in the prompt containing `:open aa\ b.txt`. This is
because the length of the input which is trimmed when replacing with
completion is calculated on the part of the input which is parsed by
shellwords and then escaped (in a separate operation), which is lossy.
In this case it loses the trailing backslash.

The fix provided here refactors shellwords to track both the _words_
(shellwords with quotes and escapes resolved) and the _parts_ (chunks
of the input which turned into each word, with separating whitespace
removed). When calculating how much of the input to delete when
replacing with the completion item, we now use the length of the last
part.

This also allows us to eliminate the duplicate work done in the
`ends_with_whitespace` check.
2 years ago
Michael Davis b474ee1843
Factor out common code for focusing the next view (#4607)
There is some common code between Editor::focus_next and Editor::focus
that can be eliminated by refactoring Tree::focus_next into a function
that only returns the next ViewId.
2 years ago
Michael Davis 6eec14ee37
Use key-sequence format for command palette keybinds (#4712)
The text within the command palette used a custom format to display
the keybinding for a command. This change switches to the key sequence
format that we use for pending keys and macros.
2 years ago
Pascal Kuthe 4b89177e53
sort fuzzy matches with equal score by length in picker (#4698) 2 years ago
Blaž Hrastnik fe11ae2218
minor: Simplify some command code 2 years ago
Blaž Hrastnik a3173c2280
minor: cloning filter and using count() is wasteful here 2 years ago
Garrett D'Amore f843967059
Improvements to Meson syntax. (#4572)
Co-authored-by: Garrett D'Amore <garrett.damore@weka.io>
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2 years ago
dependabot[bot] 70ebbd018a
build(deps): bump chrono from 0.4.22 to 0.4.23 (#4747)
Bumps [chrono](https://github.com/chronotope/chrono) from 0.4.22 to 0.4.23.
- [Release notes](https://github.com/chronotope/chrono/releases)
- [Changelog](https://github.com/chronotope/chrono/blob/main/CHANGELOG.md)
- [Commits](https://github.com/chronotope/chrono/compare/v0.4.22...v0.4.23)

---
updated-dependencies:
- dependency-name: chrono
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years ago
dxtr85 888368dae9
Fix deprecation warnings for chrono 0.4.23 (#4738)
Co-authored-by: dxtr <dxtr@W540.mito>
2 years ago
Blaž Hrastnik df6d04425d
fix build 2 years ago
Armin Ronacher 392a018aeb
Add command to add word boundaries to search (#4322)
* Add command to add word boundaries to search

* Calculate string capacity before building
2 years ago
Manos Mertzianis 77be98c783
Popup scrollbar (#4449)
* init

* cargo fmt

* optimisation of the scrollbar render both for Menu and Popup. Toggling off scrollbar for Popup<Menu>, since Menu has its own

* rendering scroll track

* removed unnecessary cast

* improve memory allocation

* small correction
2 years ago
ath3 3b7760dfb0
Refactor blackhole register (#4504) 2 years ago
Michael Davis 652497bdd6
Use tree-sitter-bicep fork with sources checked in (#4751) 2 years ago
Sora 506e8caba7
Remove Statement in Zig indentation query (#4745) 2 years ago
Gaurav Tyagi 91ff903bf3
Add global error/warning count statusline element (#4569) 2 years ago
Jonathan 1233c9a989
Add support for Bicep files (#4403) 2 years ago
dependabot[bot] 4791bd66b7
build(deps): bump cc from 1.0.74 to 1.0.76 (#4748)
Bumps [cc](https://github.com/rust-lang/cc-rs) from 1.0.74 to 1.0.76.
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Commits](https://github.com/rust-lang/cc-rs/compare/1.0.74...1.0.76)

---
updated-dependencies:
- dependency-name: cc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years ago
dependabot[bot] 4f924f4771
build(deps): bump similar from 2.2.0 to 2.2.1 (#4746)
Bumps [similar](https://github.com/mitsuhiko/similar) from 2.2.0 to 2.2.1.
- [Release notes](https://github.com/mitsuhiko/similar/releases)
- [Changelog](https://github.com/mitsuhiko/similar/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mitsuhiko/similar/compare/2.2.0...2.2.1)

---
updated-dependencies:
- dependency-name: similar
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years ago
Michael Davis c74b97447f
Fix range offsets for multiple shell insertions (#4619)
d6323b7cbc introduced a regression for
shell commands like `|`, `!`, and `<A-!>` which caused the new
selections to be incorrect. This caused a panic when piping (`|`)
would cause the new range to extend past the document end.

The paste version of this bug was fixed in
48a3965ab4.

This change also inherits the direction of the new range from the old
range and adds integration tests to ensure that the behavior isn't
broken in the future.
2 years ago
wes adams fd585c1ee4
Statusline indicator to show number of selected chars (#4682)
Co-authored-by: wes adams <wadams@grayshift.com>
2 years ago
asvln 1f72d34249 rename description for `goto_line_end_newline` 2 years ago
asvln 7468fa28fd add `extend_prev_word_end` command 2 years ago
Alexis (Poliorcetics) Bourget e232333d4a fix: Outdated Rust queries after TS update
Ref: 3ddebf46e6
2 years ago
Alexis (Poliorcetics) Bourget 53b70d821e deps: Update tree-sitter-rust (supports let-else && let-chains) 2 years ago
Bruce Hopkins bc0a3037ea
feat(commands): increment by range (#4418) 2 years ago
Anton Romanov 5b73c8c724
Add port of VIM's Zenburn, a low-contrast color scheme for Vim (#4613) 2 years ago
Chris Kipp d7be5463c5
update scala roots (#4701)
This adds in a couple more roots that are common in Scala.

- `build.sc` which is used in Mill
- `build.gradle` for Scala Gradle projects
- `.scala-build` for scala-cli projects
2 years ago
Gabriel Dinner-David 7367abd6c6
Update typescript grammar and queries (#4703)
* fix(grammars): update treesitter grammar and queries

* add override keyword

* Update runtime/queries/typescript/highlights.scm

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2 years ago
Pascal Kuthe bb5a122cde
improve performance of tree sitter query captures (for text object motions in particular) (#4707)
* add tree sitter match limit to avoid slowdowns for larger files

Affects all tree sitter queries and should speedup both
syntax highlighting and text object queries.
This has been shown to fix significant slowdowns with textobjects
for rust files as small as 3k loc.

* Apply suggestions from code review

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2 years ago
Philip Giuliani e17ad2722a
Enable elixir-ls for heex language (#4679) 2 years ago
janos-r bc52b0369b
theme dark_plus color-modes insert and select (#4678) 2 years ago
Chris Kipp 183d1fadf4
feat: add sc to filetypes for Scala (#4697)
Files ending in `.sc` are known as "Scala Scripts". The scalac compiler
knows how to handle these, popular tools like
[Ammonite](https://github.com/com-lihaoyi/Ammonite) and
[scala-cli](https://github.com/Virtuslab/scala-cli) use them, and even
some Scala build tools like [mill](https://github.com/com-lihaoyi/mill)
use them as their build files (`build.sc`). This change just makes sure
that they are treated as Scala files so Metals kicks in.
2 years ago
André Sá d7136d691a
Update ayu themes (#4662) 2 years ago
Blaž Hrastnik 758bace221
fix test compilation 2 years ago
Blaž Hrastnik 264a455c18
Move terminal out of compositor 2 years ago
Blaž Hrastnik 00d7b18097
This term specific behavior really doesn't belong to compositor 2 years ago
Blaž Hrastnik b2e7171fed
Drop terminal interaction in compositor.size() 2 years ago
Blaž Hrastnik d4f5cab7b5
Re-enable format_selections for a single selection range 2 years ago
Matthias Deiml dee5b2a983
Add LSP workspace command picker (#3140)
* Add workspace command picker

* Make command typable

* Add optional argument to lsp-workspace-command
2 years ago
Michael Davis 3e84434c69 Fix panic from indenting on tree with errors
`deepest_preceding` is known to be a descendant of `node`. Repeated
calls of `Node::parent` _should_ eventually turn `deepest_preceding`
into `node`, but when the node is errored (the tree contains a syntax
error), `Node::parent` returns None.

In the typescript case:

    if(true) &&true
    //      ^ press enter here

The tree is:

    (program [0, 0] - [1, 0]
      (if_statement [0, 0] - [0, 15]
        condition: (parenthesized_expression [0, 2] - [0, 8]
          (true [0, 3] - [0, 7]))
        consequence: (expression_statement [0, 8] - [0, 15]
          (binary_expression [0, 8] - [0, 15]
            left: (identifier [0, 8] - [0, 8])
            right: (true [0, 11] - [0, 15])))))

`node` is the `program` node and `deepest_preceding` is the
`binary_expression`. The tree is errored on the `binary_expression`
node with `(MISSING identifier [0, 8] - [0, 8])`.

In the C++ case:

    ; <<
    // press enter after the ';'

The tree is:

    (translation_unit [0, 0] - [1, 0]
      (expression_statement [0, 0] - [0, 1])
      (ERROR [0, 1] - [0, 4]
        (identifier [0, 1] - [0, 1])))

`node` is the `translation_unit` and `deepest_preceding` is the `ERROR`
node.

In both cases, `Node::parent` on the errored node returns None.
2 years ago
Michael Davis 260ae3a0f4 style: Only call extend_nodes when deepest_preceding is Some 2 years ago
Kirawi a19eee6450
Update `dark_plus` diff colors (#4661) 2 years ago
Anton Romanov 07d3157273
[rust highlights] fix scoped attribute macro matching (#4659)
Without this scoped attribute macros are not matched as macros.
Eg
```
  #[path::macro]
```
2 years ago
Marko Klobučar Ledinšćak d8e9c85f5e
`error!` on unknown `CompletionItemKind` (#4658) 2 years ago
Zhizhen He 0c30aeea5b
fix typo (#4656) 2 years ago