Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove / and \ from wordPattern #186

Merged
merged 1 commit into from
May 30, 2024
Merged

Remove / and \ from wordPattern #186

merged 1 commit into from
May 30, 2024

Conversation

ajhall
Copy link
Contributor

@ajhall ajhall commented May 30, 2024

This removes / and \ from the wordPattern value in the language-configuration.json, which fixes #185, allowing path completion to work properly.

https://code.visualstudio.com/api/language-extensions/language-configuration-guide#word-pattern

wordPattern defines what's considered as a word in the programming language. Code suggestion features will use this setting to determine word boundaries if wordPattern is set.

I'm not entirely sure this is the best possible fix, but everything I tested seems to work the way I expected and I can auto-complete paths now. For example, I tried creating a variable with a slash in the name, but it still doesn't treat that as a valid variable name.

Two thoughts according to my limited understanding of how this works:

  1. I see that the current value of wordPattern comes straight from the official example. My best guess is that a typical language server doesn't implement path completion, so usually you wouldn't want directory separators included in your word pattern. Nushell's language server does appear to do path completion, though, so it seems to make sense to allow those characters when trying to auto-complete.
  2. Most of the built-in VSCode plugins (including shellscript) don't have a wordPattern defined, so maybe this field isn't even needed most of the time?

@ajhall ajhall marked this pull request as draft May 30, 2024 03:52
@ajhall ajhall marked this pull request as ready for review May 30, 2024 04:12
@fdncred
Copy link
Collaborator

fdncred commented May 30, 2024

Seems reasonable to try this. I couldn't remember where I stole that bit from. Thanks!

@fdncred fdncred merged commit c854eb1 into nushell:main May 30, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Path completion replaces last portion of path instead of entire path
2 participants