SublimeLinter-any-lsp
SublimeLinter adapter to any LSP server
Details
Installs
- Total 50
- Win 27
- Mac 8
- Linux 15
| Nov 2 | Nov 1 | Oct 31 | Oct 30 | Oct 29 | Oct 28 | Oct 27 | Oct 26 | Oct 25 | Oct 24 | Oct 23 | Oct 22 | Oct 21 | Oct 20 | Oct 19 | Oct 18 | Oct 17 | Oct 16 | Oct 15 | Oct 14 | Oct 13 | Oct 12 | Oct 11 | Oct 10 | Oct 9 | Oct 8 | Oct 7 | Oct 6 | Oct 5 | Oct 4 | Oct 3 | Oct 2 | Oct 1 | Sep 30 | Sep 29 | Sep 28 | Sep 27 | Sep 26 | Sep 25 | Sep 24 | Sep 23 | Sep 22 | Sep 21 | Sep 20 | Sep 19 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Windows | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
| Mac | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| Linux | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 2 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
SublimeLinter-any-lsp 🎴
SublimeLinter-any-lsp is a plugin for SublimeLinter that allows you to use Language Server Protocol (LSP) servers as linters within Sublime Text.
Status
I use it since May 2024. Needs spread and contributions. Unsure about which parts (if any) should be ported to SublimeLinter core. Lack of time to make it shine, also maybe, because it just works for me.
How It Works
This package implements a generic linter backend (AnyLSP) for SublimeLinter. It communicates with LSP servers, sends file contents, and parses diagnostics messages from the server to display them as linting errors/warnings in Sublime Text.
- Each LSP server defined by a linter class (e.g.,
Ruff,Pyright,Eslint) as usual, inheritingAnyLSPinstead ofLinter. - Diagnostic messages from the LSP server are mapped to SublimeLinter errors and warnings.
Design
Be open, user-friendly, playful.
# Make a config
config = ServerConfig(
"ruff-lsp",
("ruff", "server", "--preview"),
"/user/knowles/and-her-working-dir",
)
# and ask for a server attached to a view
ensure_server_for_view(config, view)
# or a plain server
server = ensure_server(config)
# and communicate with it
req = server.request("textDocument/diagnostic", inflate({
"textDocument.uri": canoncial_uri_for_view(self.view),
}))
@req.on_response
def on_diagnostics(msg):
....
# done. Idle servers shutdown automatically. 🌆
Example Linter Classes
class Ruff(AnyLSP):
name = "ruff-lsp"
cmd = ("ruff", "server", "--preview")
defaults = {"selector": "source.python"}
class Pyright(AnyLSP):
name = "pyright-lsp"
cmd = ("pyright-langserver", "--stdio")
defaults = {
"disable": True,
"selector": "source.python",
"settings": {
"python.analysis.autoSearchPaths": True,
"python.analysis.diagnosticMode": "openFilesOnly",
"python.analysis.useLibraryCodeForTypes": True,
}
}
Installation
Manual only. Not listed on PackageControl
Usage
- Ships ruff-lsp, pyright and eslint out-of-the-box
- Any other LSP (-configuration) must be added here, as a separate (private or public) package, or just in your User folder as a plugin.
Configuration
Each linter class may be configured through SublimeLinter's settings system. For example, to enable or disable specific servers, or to pass settings to the underlying LSP.
Example:
"SublimeLinter.linters.ruff-lsp.selector": "source.python",
Contributing
Contributions are welcome! Please open issues or pull requests for bug fixes, new features, or improvements.