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

command 'zig.zls.startRestart' not found #136

Open
davidmdm opened this issue Sep 16, 2023 · 21 comments
Open

command 'zig.zls.startRestart' not found #136

davidmdm opened this issue Sep 16, 2023 · 21 comments

Comments

@davidmdm
Copy link

Hi, I have a fresh installation of zig on my mac 0.11.0, and installed zls through the vscode market place v0.4.3.

The documentation says that it should work out of the box, but any zls command I try to trigger such as start server results in an error.

image
@davidmdm
Copy link
Author

I have zig installed
I have zls installed
I have the zig language extension installed.

Documentation says everything should work out of the box but it does not. Either documentation with the correct steps need to be written, or there is a bug.

@awarebayes
Copy link

Same

@Vexu
Copy link
Member

Vexu commented Sep 18, 2023

Do you have zig.zigPath, zig.zls.path and zig.zls.enabled set? Are you seeing any output from "Zig Language Server"?

@dnut
Copy link

dnut commented Oct 9, 2023

There are two concerns here:

  • Lack of automation. This extension requires manual steps to get it working. It would be nice if the extension would just work out of the box, if practical
  • Lack of documentation. If an extension requires manual configuration before it is useful, the bare minimum steps need to be documented somewhere obvious. I've raised this issue here Document how to use ZLS #142.

Automation requires some careful thought. What are the sane defaults?

  1. Should zig or zls be installed automatically?
  2. Should the extension find zig or zls in PATH and use those?
  3. Should zig and zls be treated differently? (How does zls interoperate with various zig versions?)

@Vexu
Copy link
Member

Vexu commented Oct 9, 2023

Setup only requires answering two questions: (after #138 at least)

  • what zig to use
    • install zig
    • select path to zig
    • use zig in PATH
  • what zls to use
    • do not use zls
    • install zls
    • select path to zls
    • use zls in PATH

Everything else is automatic.

@davidmdm davidmdm closed this as completed Oct 9, 2023
@davidmdm davidmdm reopened this Oct 9, 2023
@Vexu
Copy link
Member

Vexu commented Oct 20, 2023

A new version of the extension has been published, please try running through the setup with it.

@dephiros
Copy link

Got into the same problem today with v0.5.2. Is this a regression?

@Vexu
Copy link
Member

Vexu commented Feb 10, 2024

Nobody actually confirmed if this was fixed so I don't know. Could you give details on your installation process and setup?

@dephiros
Copy link

I am running on a mac but I am using flake to install all the dependencies.

VSCode terminal recognizes the zls and zig

Starting zls manually and VSCode seems to be able to connect to it directly(go to definition...)

I wonder if there is an error somewhere that stops the commands from being registered

@Vexu
Copy link
Member

Vexu commented Feb 11, 2024

The only reasonable way it wouldn't get registered is the initial setup failing; do you have zig.initialSetupDone set in your global config?

@dephiros
Copy link

I checked mine and it is not set.
Hm, I recently starts to manage the settings with home-manager(nix) which would make the global settings readonly. Does the plugin set the option and use that as an indicator to register command?
I also tried to set the same option in workspace settings to true but that would not work

@Vexu
Copy link
Member

Vexu commented Feb 12, 2024

I wasn't able to reproduce your issues by setting the settings readonly and changing the workspace settings should have the same effect as global settings. Are you getting a modal asking you to select which zig to use? Is there anything logged in the Output view under zig?

@Vexu
Copy link
Member

Vexu commented Feb 14, 2024

Can you try if 0.5.3 fixed this for you?

@davidmdm
Copy link
Author

I think the main problem is documentation.

It's unclear from the docs or setup that these settings need to be set:

  • zig.initialSetupDone
  • zig.path
  • zig.zls.path

@dephiros
Copy link

Sorry for the delay in reponse. A couple of busy days at work. Will check it later today and report back

@Vexu
Copy link
Member

Vexu commented Feb 14, 2024

I think the main problem is documentation.

It's unclear from the docs or setup that these settings need to be set:

They need to be set but the extension sets them for you.

@dephiros
Copy link

@Vexu

Can you try if 0.5.3 fixed this for you?

I am on the 0.5.3 branch and unfortunately this does not work.

Are you getting a modal asking you to select which zig to use?
There used to be a modal until I set zig path inside my workspace settings:

  "zig.path": "/nix/store/0qglrgn4flkqdavxkw4snvr3zn5496y7-zig-0.12.0-dev.2327+b0c8a3f31/bin/zig",
  "zig.zls.path": "/nix/store/q9f3k6djhc6nfyj63249nda1qk5v4zkg-zls/bin/zls",
  "zig.formattingProvider": "zls",
  "zig.initialSetupDone": true,
  "zig.zls.checkForUpdate": false

There was a modal that pop-up every time I open VSCode about error writing to readonly file. I double checked if this is caused by the extension by disable the extension and it would stop
Screenshot 2024-02-14 at 14 45 13

Maybe the extension crashes after failing to set the settings? Would it be possible for the extension to set the workspace settings instead or use an alternative method to store init state?

There are also no zig output:

Screenshot 2024-02-14 at 14 40 19

@Vexu
Copy link
Member

Vexu commented Feb 14, 2024

By "0.5.3 branch" you mean the extension reports version 0.5.3? Can you try setting zig.checkForUpdates to false? It's the only other setting I can think of that it could be trying to set.

@dephiros
Copy link

dephiros commented Feb 15, 2024

oh sorry i meant extension version 0.5.3 and not the branch.

I set the workspace extensions to

{
  "editor.formatOnSave": true,
  "files.autoSave": "onFocusChange",
  "zig.path": "/nix/store/0qglrgn4flkqdavxkw4snvr3zn5496y7-zig-0.12.0-dev.2327+b0c8a3f31/bin/zig",
  "zig.zls.path": "/nix/store/q9f3k6djhc6nfyj63249nda1qk5v4zkg-zls/bin/zls",
  "zig.checkForUpdate": false,
  "zig.formattingProvider": "zls",
  "zig.initialSetupDone": true,
  "zig.zls.checkForUpdate": false
}

The extension still try to write to the global settings but it seems like zls starts correctly and I can run "Start/Restart server" now

@dnut
Copy link

dnut commented Feb 16, 2024

I think the main problem is documentation.

It's unclear from the docs or setup that these settings need to be set:

* zig.initialSetupDone

* zig.path

* zig.zls.path

I agree, which is why I created #142. Unfortunately, this was closed without any documentation being added. I would have been happy to open a pr to address this if I thought the maintainers would be receptive to it.

I think the maintainers have a philosophy about software development that UX alone should be good enough to make documentation unnecessary. I agree that this is a good goal that we should all pursue. But it is not realistic to assume that it can always be reached 100%, especially when the software is just a plugin with UX that is tightly constrained by another application.

I occasionally set up new vscode instances with this extension and in my experience, these settings often do not get configured. I dealt with this as recently as last week. There are supposed to be prompts to ensure these are configured, but I don't think this approach is very reliable.

I already know that they need to be set, so I manually go into the config file and edit the values when necessary. For new users who don't have this knowledge yet, it could be useful to have a simple explanation to help them troubleshoot when these values are not set correctly, so they don't need to go through github issues to figure it out. It would also be useful for anyone who needs to make changes to their zig tooling after the initial setup of this extension.

@Vexu
Copy link
Member

Vexu commented Feb 16, 2024

I don't want users to have to read documentation to use the basic funcionalities of the extension and I think the initial setup is now good enough to accomplish that. If you make a PR that adds some documentation describing the key configuration values and some troubleshooting tips then I'll gladly merge it.

Techatrix added a commit that referenced this issue Sep 7, 2024
These changes make ZLS an "invisible" component of the extension after the initial setup.

This also removes the `zig.zls.checkForUpdate` command. I am not sure if it even needs to be brought back. I've made sure that no error is reported if no internet connection is available. The last installed ZLS version should be reused.

closes #136 because `zig.zls.startRestart` will just enable ZLS instead of complaining
Techatrix added a commit that referenced this issue Sep 24, 2024
These changes make ZLS an "invisible" component of the extension after the initial setup.

This also removes the `zig.zls.checkForUpdate` command. I am not sure if it even needs to be brought back. I've made sure that no error is reported if no internet connection is available. The last installed ZLS version should be reused.

closes #136 because `zig.zls.startRestart` will just enable ZLS instead of complaining
Techatrix added a commit that referenced this issue Sep 29, 2024
These changes make ZLS an "invisible" component of the extension after the initial setup.

This also removes the `zig.zls.checkForUpdate` command. I am not sure if it even needs to be brought back. I've made sure that no error is reported if no internet connection is available. The last installed ZLS version should be reused.

closes #136 because `zig.zls.startRestart` will just enable ZLS instead of complaining
Techatrix added a commit that referenced this issue Oct 12, 2024
These changes make ZLS an "invisible" component of the extension after the initial setup.

This also removes the `zig.zls.checkForUpdate` command. I am not sure if it even needs to be brought back. I've made sure that no error is reported if no internet connection is available. The last installed ZLS version should be reused.

closes #136 because `zig.zls.startRestart` will just enable ZLS instead of complaining
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

No branches or pull requests

5 participants