Skip to content

Fix syntax errors #1081

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

Merged
merged 3 commits into from
Feb 3, 2024
Merged

Fix syntax errors #1081

merged 3 commits into from
Feb 3, 2024

Conversation

Roger-Roger-debug
Copy link
Contributor

I tried copying the examples but got errors like

 163 │     match $spans.0
     ·                   ▲
     ·                   ╰── missing match_block
 164 │     {
     ╰────

I just got started using nushell so this might be wrong.

Copy link
Member

@sholderbach sholderbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thnanks for giving this a good look!

I think the snippets in the sections preceding "Multiple completer" don't make as much sense after #1049?

Comment on lines +49 to +50
z => $zoxide_completer
zi => $zoxide_completer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mhh this is not valid Nu code outside of a match. There may be some work necessary to get this section up to date. Previously, before match existed things like this where handled with records for which this is the correct syntax.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still a bit lost with everything. Just reading the docs it says that "This completer is not usable for allmost every other command, so it's recommended to add it as an override in the multiple completer:". I copy-pasted it to the appropriate place and got the syntax error.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mhh maybe @JoaquinTrinanes has a recommendation for that, as he set up his completions with match

Copy link
Contributor

@JoaquinTrinanes JoaquinTrinanes Sep 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No wonder it doesn't work, those snippets where written when the completer options were a record | get | default instead of a match 😅

As far as I can tell these changes should be enough, but maybe it should be made clearer where this configuration goes, and emphasize that it's a match statement?

Or just writing it as

match $spans.0 {
    ...
   __zoxide_z | __zoxide_zi => $zoxide_completer
    ...
}

Btw, found a typo at This completer is not usable for alLmost ...

Happy to lend a hand rewriting this if needed :) As far as I can see no other snippets need updating. And if users are using the multiple_completer from the cookbook they shouldn't run into any issue if we leave this written as-is (with the invalid match syntax) as it'll be pasted in a correct match statement.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed the typo and added zoxide to the full example, I hope this is what you had in mind.

@@ -68,8 +68,7 @@ Sometimes, a single external completer is not flexible enough. Luckily, as many

```nu
let multiple_completers = {|spans|
match $spans.0
{
match $spans.0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

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.

4 participants