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

How to use with Zig? #1054

Closed
daurnimator opened this issue May 17, 2020 · 3 comments
Closed

How to use with Zig? #1054

daurnimator opened this issue May 17, 2020 · 3 comments

Comments

@daurnimator
Copy link

  • OS and language server: Linux
  • How you installed LSP (Package Control or from git?): Package Control

I'd like to use your project with the Zig language. However I didn't find the instructions clear. Currently the preferred LSP is zls. The zig sublime package is here (which I install via package control).

How do I figure out the:

  • languageId
  • scope(s)
  • syntaxes
Further info:

$ find ~/.config/sublime-text-3 -iname '*zig*'
/home/daurnimator/.config/sublime-text-3/Packages/User/Zig.sublime-settings
/home/daurnimator/.config/sublime-text-3/Installed Packages/Zig Language.sublime-package
/home/daurnimator/.config/sublime-text-3/Cache/User/Zig
/home/daurnimator/.config/sublime-text-3/Cache/User/Zig/Zig.tmLanguage.cache
/home/daurnimator/.config/sublime-text-3/Cache/Zig Language
/home/daurnimator/.config/sublime-text-3/Cache/Zig Language/Zig.tmLanguage.cache
/home/daurnimator/.config/sublime-text-3/Cache/Zig Language/Zig.tmLanguage.rcache
/home/daurnimator/.config/sublime-text-3/Cache/Zig Language/Syntaxes/Zig.tmLanguage.cache
/home/daurnimator/.config/sublime-text-3/Cache/Zig Language/Syntaxes/Zig.tmLanguage.rcache

Random guess for config:

{
  "clients": {
	"zig": {
		"command": ["zls"],
		"enable": true,
		"languageId": "zig",
		"scopes": [
			"source.zig"
		],
		"syntaxes": [
			"Packages/User/Zig.sublime-syntax"
		]
	}
  }
}

@rwols
Copy link
Member

rwols commented May 17, 2020

It should be:

{
    "clients": {
        "zig":{
            "command": ["zls"],
            "enabled": true,
            "languageId": "zig",
            "scopes": ["source.zig"],
            "syntaxes": ["Packages/Zig Language/Syntaxes/Zig.tmLanguage"]
        }
    }
}

provided that zls is in your $PATH. Restart ST after you've made changes to LSP.sublime-settings.

You can figure out the scope with Tools > Developer > Show Scope Name.
You can figure out the syntax by opening the ST console and running view.settings().get("syntax").

@daurnimator
Copy link
Author

You can figure out the scope with Tools > Developer > Show Scope Name.
You can figure out the syntax by opening the ST console and running view.settings().get("syntax").

Thanks! Could you add this info somewhere on https://lsp.readthedocs.io/en/latest/ ?

@predragnikolic
Copy link
Member

@daurnimator feel free to open a PR :)
the documentation you see on https://lsp.readthedocs.io/en/latest/ is defined in the LSP repo. (to be precise in LSP/docs/index.md)
Also you could also add it in the list of supported languages in the main README (https://github.com/sublimelsp/LSP#available-languages).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants