Commit Graph

4269 Commits

Author SHA1 Message Date
dependabot[bot]
400697fc68
build(deps): bump gix from 0.39.0 to 0.41.0 (#6306)
Bumps [gix](https://github.com/Byron/gitoxide) from 0.39.0 to 0.41.0.
- [Release notes](https://github.com/Byron/gitoxide/releases)
- [Changelog](https://github.com/Byron/gitoxide/blob/main/CHANGELOG.md)
- [Commits](https://github.com/Byron/gitoxide/compare/gix-v0.39.0...gix-v0.41.0)

---
updated-dependencies:
- dependency-name: gix
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-14 10:57:31 +09:00
Michael Davis
fb4d703b9f Update Nix highlights
* Switch nix grammar repository location to the new repo. The author
  has transferred the repository to 'nix-community'.
* Capture ':' and '...' as 'punctuation.delimiter'.
2023-03-14 10:56:49 +09:00
Michael Davis
cdd6c8d91e Update Erlang highlights
* Macros that start with underscore were incorrectly marked as
  'comment.unused' rather than 'keyword.directive' due to an ordering
  issue of those two patterns.
* Recognize escripts as Erlang by the shebang.
2023-03-14 10:56:49 +09:00
Michael Davis
bb41a283e6
theme: Use inheritance for gruvbox themes (#6295)
These gruvbox variants were introduced before theme inheritance and
only differ by a few colors. This change cleans up the duplicated
theming with theme inheritance.
2023-03-14 10:56:22 +09:00
dependabot[bot]
b558ce7148
build(deps): bump indoc from 2.0.0 to 2.0.1 (#6302)
Bumps [indoc](https://github.com/dtolnay/indoc) from 2.0.0 to 2.0.1.
- [Release notes](https://github.com/dtolnay/indoc/releases)
- [Commits](https://github.com/dtolnay/indoc/compare/2.0.0...2.0.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-13 19:26:41 -05:00
dependabot[bot]
6c4d14cb4b
build(deps): bump toml from 0.7.2 to 0.7.3 (#6305)
Bumps [toml](https://github.com/toml-rs/toml) from 0.7.2 to 0.7.3.
- [Release notes](https://github.com/toml-rs/toml/releases)
- [Commits](https://github.com/toml-rs/toml/compare/toml-v0.7.2...toml-v0.7.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-13 19:25:59 -05:00
dependabot[bot]
4d4bb07419
build(deps): bump libc from 0.2.139 to 0.2.140 (#6304)
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.139 to 0.2.140.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.139...0.2.140)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-13 19:24:50 -05:00
dependabot[bot]
a590167533
build(deps): bump chrono from 0.4.23 to 0.4.24 (#6301)
Bumps [chrono](https://github.com/chronotope/chrono) from 0.4.23 to 0.4.24.
- [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.23...v0.4.24)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-13 19:23:58 -05:00
Ivan
955eb5b2de
queries/php: add missing keywords unset and clone (#6299) 2023-03-13 19:21:44 -05:00
Francesc Elies
d15f9721a5
LSP: Separate diagnostic picker message and code (#6095) 2023-03-13 12:01:21 -05:00
misiasty3
db8e9f5bb2
Check language server symbol renaming support before prompting (#6257)
Co-authored-by: Poliorcetics <poliorcetics@users.noreply.github.com>
2023-03-13 10:29:23 -05:00
Josh Bainbridge
dc418bb507
Update gruvbox color themes to support inlay hint (#6285)
The gruvbox themes (gruvbox, gruvbox dark hard and guvbox light)
don't provide a colour for the new virtual inlay hints. Looking at the
original repo, and other derivatives, there doesn't appear to be a clear
definition of what inlay hints should be. Although most sources indicate
that it can be the same as the color for comments.

Considering that, this commit sets the new field on each of the three
themes to be gray1, same as commented text.

Signed-off-by: Josh Bainbridge <josh.bainbridge@gmail.com>
2023-03-13 09:36:40 -05:00
Maxwell Anderson
951aecc019
Add molokai theme (#6260) 2023-03-13 21:52:45 +08:00
workingj
66033edeaf
add ui.inlay-hint (#6292) 2023-03-13 22:40:13 +09:00
Cole Helbling
34934733b3
helix-term: send the STOP signal to all processes in the process group (#3546)
* helix-term: send the STOP signal to all processes in the process group

From kill(3p):

    If pid is 0, sig shall be sent to all processes (excluding an unspecified set
    of  system processes) whose process group ID is equal to the process group ID
    of the sender, and for which the process has permission to send a signal.

This fixes the issue of running `git commit`, attempting to suspend
helix with ^Z, and then not regaining control over the terminal and
having to press ^Z again.

* helix-term: use libc directly to send STOP signal

* helix-term: document safety of libc::kill

* helix-term: properly handle libc::kill's failure

I misread the manpage for POSIX `kill` -- it returns `-1` in
the failure case, and sets `errno`, which is retrieved via
`std::io::Error::last_os_error()`, has its string representation printed
out, and then exits with the matching status code (or 1 if, for whatever
reason, there is no matching status code).

* helix-term: expand upon why we need to SIGSTOP the entire process group

Also add a link back to one of the upstream issues.
2023-03-13 20:08:57 +08:00
Michael Davis
4f066b1cc6
LSP: No-op client/registerCapability requests (#6258) 2023-03-13 09:29:58 +09:00
Jonatan Pettersson
1126af53b4
Test indentation level calculation (#6281)
Co-authored-by: Jonatan Pettersson <jonatan.pettersson@proton.me>
2023-03-12 12:41:07 -05:00
Stanisław Borowy
39052433ed
Fix indentation level calculation for lines mixing tabs and spaces (#6278) 2023-03-12 12:12:06 -05:00
Jens Getreu
6e432e8636
Autumn theme: add ui.virtual.inlay-hint config (#6280)
The configuration differs between parameters (upright) and types (slanted).
2023-03-12 11:59:09 -05:00
Kirawi
db8c86a9a3
dark_plus: theme inlay-hint (#6283)
Taken from the official theme:
```json
"editorInlayHint.background": "#4d4d4dcc",
"editorInlayHint.foreground": "#ffffff",
"editorInlayHint.parameterBackground": "#4d4d4dcc",
"editorInlayHint.parameterForeground": "#ffffff",
"editorInlayHint.typeBackground": "#4d4d4dcc",
"editorInlayHint.typeForeground": "#ffffff",
```
2023-03-12 11:57:21 -05:00
Erasin Wang
221a4ac883
Theme onelight add inlay-hint (#6276)
- fix: add `markup.strikethrough` for theme.md 
- add virtual.inlay-hint
- fix ui.virtual.wrap
- rename light-white to grey-300
2023-03-12 11:56:54 -05:00
Ivan
14f1a62367
theme/catppuccin: add ui.virtual.inlay-hint (#6269) 2023-03-11 08:04:37 -06:00
Jonatan Pettersson
f435f3b2e9
Document how to run tests (#6268)
Co-authored-by: Jonatan Pettersson <jonatan.pettersson@proton.me>
2023-03-11 08:03:19 -06:00
Kirawi
bb72079743
fleet_dark: theme inlay hints (#6266) 2023-03-11 08:02:04 -06:00
Blaž Hrastnik
81601b1c6c
fix: C++ namespace indentation
fixes #6235
2023-03-11 11:50:11 +09:00
Pascal Kuthe
171d28d2bd
indent snippets to line indent instead of completion start (#6263) 2023-03-11 11:34:43 +09:00
Poliorcetics
bdcd4d9411
Feat: LSP Type Hints (#5934)
* misc: missing inline, outdated link

* doc: Add new theme keys and config option to book

* fix: don't panic in Tree::try_get(view_id)

Necessary for later, where we could be receiving an LSP response
for a closed window, in which case we don't want to crash while
checking for its existence

* fix: reset idle timer on all mouse events

* refacto: Introduce Overlay::new and InlineAnnotation::new

* refacto: extract make_job_callback from Context::callback

* feat: add LSP display_inlay_hint option to config

* feat: communicate inlay hints support capabilities of helix to LSP server

* feat: Add function to request range of inlay hint from LSP

* feat: Save inlay hints in document, per view

* feat: Update inlay hints on document changes

* feat: Compute inlay hints on idle timeout

* nit: Add todo's about inlay hints for later

* fix: compute text annotations for current view in view.rs, not document.rs

* doc: Improve Document::text_annotations() description

* nit: getters don't use 'get_' in front

* fix: Drop inlay hints annotations on config refresh if necessary

* fix: padding theming for LSP inlay hints

* fix: tracking of outdated inlay hints should not be dependant on document revision (because of undos and such)

* fix: follow LSP spec and don't highlight padding as virtual text

* config: add some LSP inlay hint configs
2023-03-11 11:32:14 +09:00
Maxicarlos08
3d230e701d
Also highlight unchecked variants of the sqlx query methods (#6256) 2023-03-10 16:57:52 -06:00
Ivan
3907358103
queries/php: add injections for regex and sql injection (#6250) 2023-03-10 16:56:18 -06:00
Dimitar Gyurov
1661e4b5e1
Add a version-control statusline element (#5682) 2023-03-10 16:42:42 -06:00
Philipp Mildenberger
98415f288f
Improved yuck highlighting (and parser), and introduced a tag.builtin scope (#6242) 2023-03-10 10:32:45 -06:00
Pascal Kuthe
d63e570e0a treat replace/insertmode consistently, default to insert 2023-03-10 16:54:17 +09:00
Pascal Kuthe
b1f7528090 fix snippet bugs and multicursor completion edgecases
Multicursor completions may overlap and therefore overlapping
completions must be dropped to avoid crashes. Furthermore, multicursor
edits might simply be out of range if the word before/after the cursor
is shorter. This currently leads to crashes, instead these selections
are now also removed for completions.

This commit also significantly refactors snippet transaction generation
so that tabstops behave correctly with the above rules. Furthermore,
snippet tabstops need to be carefully mapped to ensure their position
is correct and consistent with our selection semantics. Finally,
we now keep a partially updated Rope while creating snippet
transactions so that we can fill information into snippets that
depends on the position in the document.
2023-03-10 16:54:17 +09:00
Pascal Kuthe
2b64a64d7e Add API to create a Transaction from potentially overlapping changes
This commit adds new functions to `Transaction` that allow creating
edits that might potentially overlap. Any change that overlaps
previous changes is ignored. Furthermore, a utility method is added
that also drops selections associated with dropped changes (for
transactions that are created from a selection).

This is needed to avoid crashes when applying multicursor
autocompletions, as the edit from a previous cursor may overlap
with the next cursor/edit.
2023-03-10 16:54:17 +09:00
Pascal Kuthe
cdec933523 avoid allocations during snippet rendering 2023-03-10 16:54:17 +09:00
Pascal Kuthe
e91289fda1 Add IntoIterator implementation for Selection 2023-03-10 16:54:17 +09:00
Taylor C. Richberger
9b4326b18b allow LSP insert text to replace non-matching prefixes (#5469)
Most LSPs will complete case-insensitive matches, particularly from
lowercase to uppercase.  In some cases, notably Pyright, this is given
as a simple insert text instead of TextEdit.  When this happens, the
prefix text was left unedited.
2023-03-10 16:54:17 +09:00
paul-scott
ce1fb9e64c
Generalised to multiple runtime directories with priorities (#5411)
* Generalised to multiple runtime directories with priorities

This is an implementation for #3346.

Previously, one of the following runtime directories were used:

1. `$HELIX_RUNTIME`
2. sibling directory to `$CARGO_MANIFEST_DIR`
3. subdirectory of user config directory
4. subdirectory of path to helix executable

The first directory provided / found to exist in this order was used as a
root for all runtime file searches (grammars, themes, queries).

This change lowers the priority of `$HELIX_RUNTIME` so that the user
config runtime has higher priority. More significantly, all of these
directories are now searched for runtime files, enabling a user to override
default or system-level runtime files. If the same file name appears
in multiple runtime directories, the following priority is now used:

1. sibling directory to `$CARGO_MANIFEST_DIR`
2. subdirectory of user config directory
3. `$HELIX_RUNTIME`
4. subdirectory of path to helix executable

One exception to this rule is that a user can have a `themes`
directory directly in the user config directory that has higher piority
to `themes` directories in runtime directories. That behaviour has been
preserved.

As part of implementing this feature `theme::Loader` was simplified
and the cycle detection logic of the theme inheritance was improved to
cover more cases and to be more explicit.

* Removed AsRef usage to avoid binary growth

* Health displaying ;-separated runtime dirs

* Changed HELIX_RUNTIME build from src instructions

* Updated doc for more detail on runtime directories

* Improved health symlink printing and theme cycle errors

The health display of runtime symlinks now prints both ends of the
link.

Separate errors are given when theme file is not found and when the
only theme file found would form an inheritence cycle.

* Satisfied clippy on passing Path

* Clarified highest priority runtime directory purpose

* Further clarified multiple runtime details in book

Also gave markdown headings to subsections.

Fixed a error with table indentation not building
table that also appears present on master.

---------

Co-authored-by: Paul Scott <paul.scott@anu.edu.au>
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2023-03-09 23:50:43 +09:00
gibbz00
2cf4ce2356
Fix shrink_selection with multiple cursors. (#6093)
* Fix #6092

Cause were some incorrect assumptions that missed an edge case in the
`Selection.contains()` calculation. Tests were added accordingly.

* Fix Selection.contains() edge-case handling.

Removing the len check short-circuit was the only thing needed as
pointed out by @dead10ck.
2023-03-09 13:08:28 +09:00
Pascal Kuthe
aabc8af95d correctly store snapshots when repeating insert-mode actions
Repeating completions currently crates a savepoint when a completion
popup was triggered (so after the request completed). Just like for
normal completions the savepoint must be created at the request.

The occurrence of the completion request was previously not saved in
`last_insert`. To that end a new `InsertEvent::RequestCompletion`
variant has been added. When replayed this event creates a snapshot
that is "actived" by the `TriggerCompletion` event and subsequently
used during any `InsertEvent::CompletiuonApply` events.
2023-03-09 13:01:02 +09:00
Pascal Kuthe
8cb7cdfd7a discard stale completion requests
Completion requests are computed asynchronously to avoid common micro
freezes while editing. This means that once a completion request
completes, the state of the editor might have changed. Currently,
there is a check to ensure we are still in insert mode. However,
we also need to ensure that the view and document hasn't changed
to avoid accidentally using a savepoint with the wrong view/document.

Furthermore, the editor might request a new completion while the
previous completion request hasn't complemented yet. This can
lead to weird flickering or an outdated completion request replacing
a newer completion that has already completed (the LSP server
is not required to process completion requests in order). This change
also needed to ensure determinism/linear ordering so that completion
popup always correspond to the last completion request.
2023-03-09 13:01:02 +09:00
Pascal Kuthe
e8898fd9a8 store multiple snapshots on the document at once
Fixing autocomplete required moving the document savepoint before the
asynchronous completion request. However, this in turn causes new bugs:

If the completion popup is open, the savepoint is restored when the
popup closes (or another entry is selected). However, at that point
a new completion request might already have been created which
would have replaced the new savepoint (therefore leading to incorrectly
applied complies).

This commit fixes that bug by allowing in arbitrary number of
savepoints to be tracked on the document. The savepoints are reference
counted and therefore remain valid as long as any reference to them
remains. Weak reference are stored on the document and any reference
that can not be upgraded anymore (hence no strong reference remain)
are automatically discarded.
2023-03-09 13:01:02 +09:00
Pascal Kuthe
2588fa3710 save selection before completion savepoint
Currently, the selection is not saved/restored when completion
checkpoints are applied. This is usually fine because undoing changes
usually restores maps selections back in insert mode. But this is not
always the case and especially problematic in the presence of
multi-cursor completions (since completions are applied relative to
the selection/cursor) and snippets (which can change the selection)
2023-03-09 13:01:02 +09:00
Pascal Kuthe
4300a3ad05 create savepoint before requesting completion 2023-03-09 13:01:02 +09:00
workingj
bc23e54805
feat(theme): Update pop-dark statusline (#6227)
* update pop-theme for color-modes

* fixed ui.statusline.select not worrking

* adjustments for nicer statusline visuals

* added status line color
2023-03-09 11:17:45 +09:00
gibbz00
34be71fb50
Theme - auy_evolve: Up bufferline fg brightness (#6225)
Currently a bit hard to discern inactive and active buffers in a
brighter environment.
2023-03-08 08:06:34 -06:00
Kyle Smith
44ff8a1df1
LSP: Support textDocument/prepareRename (#6103)
* LSP: Support textDocument/prepareRename

'textDocument/prepareRename' can be used by the client to ask the
server the range of the symbol under the cursor which would be changed
by a subsequent call to 'textDocument/rename' with that position.

We can use this information to fill the prompt with an accurate prefill
which can improve the UX for renaming symbols when the symbol doesn't
align with the "word" textobject. (We currently use the "word"
textobject as a default value for the prompt.)

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

* clippy fixes

* rustfmt

* Update helix-term/src/commands/lsp.rs

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

* Update helix-term/src/commands/lsp.rs

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

* fix clippy from suggestions

* Update helix-term/src/commands/lsp.rs

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

---------

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2023-03-08 11:11:43 +09:00
Kyle Smith
3849ca4c2a
Add test cases for existing pair matching logic. (#6027)
* Add test cases for existing pair matching logic.

* fix clippy
2023-03-08 11:10:55 +09:00
Clément Delafargue
8dd1ab4899
Softwrapping improvements (#5893)
* use max_line_width + 1 during softwrap to account for newline char

Helix softwrap implementation always wraps lines so that the newline
character doesn't get cut off so he line wraps one chars earlier then
in other editors. This is necessary, because newline chars are always
selecatble in helix and must never be hidden.

However That means that `max_line_width` currently wraps one char
earlier than expected. The typical definition of line width does not
include the newline character and other helix commands like `:reflow`
also don't count the newline character here.

This commit makes softwrap use `max_line_width + 1` instead of
`max_line_width` to correct the impedance missmatch.

* fix typos

Co-authored-by: Jonathan Lebon <jonathan@jlebon.com>

* Add text-width to config.toml

* text-width: update setting documentation

* rename leftover config item

* remove leftover max-line-length occurrences

* Make `text-width` optional in editor config

When it was only used for `:reflow` it made sense to have a default
value set to `80`, but now that soft-wrapping uses this setting, keeping
a default set to `80` would make soft-wrapping behave more aggressively.

* Allow softwrapping to ignore `text-width`

Softwrapping wraps by default to the viewport width or a configured
`text-width` (whichever's smaller). In some cases we only want to set
`text-width` to use for hard-wrapping and let longer lines flow if they
have enough space. This setting allows that.

* Revert "Make `text-width` optional in editor config"

This reverts commit b247d526d6.

* soft-wrap: allow per-language overrides

* Update book/src/configuration.md

Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>

* Update book/src/languages.md

Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>

* Update book/src/configuration.md

Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>

---------

Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>
Co-authored-by: Jonathan Lebon <jonathan@jlebon.com>
Co-authored-by: Alex Boehm <alexb@ozrunways.com>
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2023-03-08 11:02:11 +09:00
Kyle Smith
f4bdbe4674
Do not add intermediate lines to jumplist with :<linenum> command. (#5751)
* Do not add intermediate lines to jumplist with :<linenum> command.

* Revert jumplist index changes.

* Reduce calculations during update cycle.

* Use jumplist for undo, set jumplist before preview.

* remove some debug logging

* Revert "remove some debug logging"

This reverts commit 5772c4327e.

* Revert "Use jumplist for undo, set jumplist before preview."

This reverts commit f73a1b2982.

* Add last_selection, update implementation.

* @pascalkuthe initial feedback

* Ensure ":goto 123" keybinding works as expected.

* fix clippies, prefer expect() for expect last_selection state
2023-03-08 10:53:31 +09:00