Skip to content

Commit

Permalink
Merge branch 'main' into workspace-symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
jwortmann committed Dec 5, 2023
2 parents 1a4b8a5 + 34c49dd commit 4e61a81
Show file tree
Hide file tree
Showing 31 changed files with 3,532 additions and 949 deletions.
42 changes: 21 additions & 21 deletions Main.sublime-menu
Original file line number Diff line number Diff line change
Expand Up @@ -25,50 +25,50 @@
},
{
"command": "lsp_source_action",
"args": {"id": -1}
"args": {"index": -1}
},
{
"caption": "LSP: Source Action",
"children": [
{
"command": "lsp_source_action",
"args": {"id": 0}
"args": {"index": 0}
},
{
"command": "lsp_source_action",
"args": {"id": 1}
"args": {"index": 1}
},
{
"command": "lsp_source_action",
"args": {"id": 2}
"args": {"index": 2}
},
{
"command": "lsp_source_action",
"args": {"id": 3}
"args": {"index": 3}
},
{
"command": "lsp_source_action",
"args": {"id": 4}
"args": {"index": 4}
},
{
"command": "lsp_source_action",
"args": {"id": 5}
"args": {"index": 5}
},
{
"command": "lsp_source_action",
"args": {"id": 6}
"args": {"index": 6}
},
{
"command": "lsp_source_action",
"args": {"id": 7}
"args": {"index": 7}
},
{
"command": "lsp_source_action",
"args": {"id": 8}
"args": {"index": 8}
},
{
"command": "lsp_source_action",
"args": {"id": 9}
"args": {"index": 9}
}
]
},
Expand All @@ -81,43 +81,43 @@
},
{
"command": "lsp_refactor",
"args": {"id": 0}
"args": {"index": 0}
},
{
"command": "lsp_refactor",
"args": {"id": 1}
"args": {"index": 1}
},
{
"command": "lsp_refactor",
"args": {"id": 2}
"args": {"index": 2}
},
{
"command": "lsp_refactor",
"args": {"id": 3}
"args": {"index": 3}
},
{
"command": "lsp_refactor",
"args": {"id": 4}
"args": {"index": 4}
},
{
"command": "lsp_refactor",
"args": {"id": 5}
"args": {"index": 5}
},
{
"command": "lsp_refactor",
"args": {"id": 6}
"args": {"index": 6}
},
{
"command": "lsp_refactor",
"args": {"id": 7}
"args": {"index": 7}
},
{
"command": "lsp_refactor",
"args": {"id": 8}
"args": {"index": 8}
},
{
"command": "lsp_refactor",
"args": {"id": 9}
"args": {"index": 9}
}
]
},
Expand Down
20 changes: 4 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
:information_source: You are reading the README of the `main` branch. This branch targets ST4. If you are looking for the ST3 version, switch to the [st3 branch](https://github.com/sublimelsp/LSP/tree/st3).

<p>
<h1 align="center">LSP</h1>
</p>

<p align="center">
<a href="https://github.com/sublimelsp/LSP/blob/main/LICENSE">
<img src="https://img.shields.io/github/license/sublimelsp/LSP">
</a>
<a href="https://github.com/sublimelsp/LSP/releases">
<img src="https://img.shields.io/github/release/sublimelsp/LSP.svg">
</a>
<a href="https://lsp.sublimetext.io">
<img src="https://img.shields.io/badge/docs-ST4-blue">
</a>
<a href="#chat">
<img src="https://img.shields.io/discord/280102180189634562?label=SublimeHQ%20Discord&logo=discord">
</a>
<br>
<a href="https://github.com/sublimelsp/LSP/blob/main/LICENSE"><img src="https://img.shields.io/github/license/sublimelsp/LSP"></a>
<a href="https://github.com/sublimelsp/LSP/releases"><img src="https://img.shields.io/github/release/sublimelsp/LSP.svg"></a>
<a href="https://lsp.sublimetext.io"><img src="https://img.shields.io/badge/docs-lsp.sublimetext.io-blue"></a>
<a href="https://discord.gg/TZ5WN8t"><img src="https://img.shields.io/discord/280102180189634562?label=SublimeHQ%20Discord&logo=discord"></a>
</p>

<p align="center">Like an IDE, except it's the good parts. <a href="https://lsp.sublimetext.io">Learn more</a>.</p>
Expand Down Expand Up @@ -45,7 +34,6 @@ See more information in the [documentation](https://lsp.sublimetext.io) :open_bo
## Getting help

If you have any problems, see the [troubleshooting](https://sublimelsp.github.io/LSP/troubleshooting/) guide for tips and known limitations. If the documentation cannot solve your problem, you can look for help in:
<a name="chat"></a>

* The [#lsp](https://discordapp.com/channels/280102180189634562/645268178397560865) channel (join the [SublimeHQ Discord](https://discord.gg/TZ5WN8t) first!)
* By [searching or creating a new issue](https://github.com/sublimelsp/LSP/issues)
4 changes: 2 additions & 2 deletions boot.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
from .plugin.core.open import opening_files
from .plugin.core.panels import PanelName
from .plugin.core.protocol import Error
from .plugin.core.registry import LspCollapseTreeItemCommand
from .plugin.core.registry import LspExpandTreeItemCommand
from .plugin.core.registry import LspNextDiagnosticCommand
from .plugin.core.registry import LspOpenLocationCommand
from .plugin.core.registry import LspPrevDiagnosticCommand
Expand All @@ -36,6 +34,8 @@
from .plugin.core.signature_help import LspSignatureHelpNavigateCommand
from .plugin.core.signature_help import LspSignatureHelpShowCommand
from .plugin.core.transports import kill_all_subprocesses
from .plugin.core.tree_view import LspCollapseTreeItemCommand
from .plugin.core.tree_view import LspExpandTreeItemCommand
from .plugin.core.typing import Any, Optional, List, Type, Dict
from .plugin.core.views import LspRunTextCommandHelperCommand
from .plugin.document_link import LspOpenLinkCommand
Expand Down
2 changes: 1 addition & 1 deletion docs/src/language_servers.md
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ There are multiple options:
"command": ["solargraph", "stdio"],
"selector": "source.ruby | text.html.ruby",
"initializationOptions": {
"diagnostics": false
"diagnostics": true
}
}
}
Expand Down
92 changes: 12 additions & 80 deletions language-ids.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
// -------------------------------------
//
// These are the "exceptional" base scopes. If a base scope is not in this
// map, then the rule is that we split the base scopes on the ".", and take
// the last element. The resuling string is assumed to be the language ID.
// map, nor the first two components or more match any of the entries here, then
// the rule is that we split the base scope on the ".", and take
// the second component. The resulting string is assumed to be the language ID.
//
// Examples of this rule:
// Examples:
//
// source.julia -> julia
// source.c++ -> cpp
// source.rust -> rust
// text.tex.latex -> latex
// text.html.vue -> vue
//
// The official list is maintained at
// https://microsoft.github.io/language-server-protocol/specification#textDocumentItem
Expand All @@ -21,103 +21,35 @@
// request at github.com/sublimelsp/LSP if you believe an entry is missing.
{
"source.c++": "cpp",
"source.coffee.gulpfile": "coffeescript", // https://github.com/SublimeText/AFileIcon
"source.coffee": "coffeescript",
"source.cs": "csharp",
"source.css.tailwind": "css", // https://github.com/SublimeText/TailwindCSS
"source.dosbatch": "bat",
"source.fixedform-fortran": "fortran", // https://packagecontrol.io/packages/Fortran
"source.groovy.gradle": "groovy", // https://github.com/SublimeText/AFileIcon
"source.groovy.jenkins": "groovy", // https://github.com/SublimeText/AFileIcon
"source.js": "javascript",
"source.js.eslint": "javascript", // https://github.com/SublimeText/AFileIcon
"source.js.gruntfile": "javascript", // https://github.com/SublimeText/AFileIcon
"source.js.gulpfile": "javascript", // https://github.com/SublimeText/AFileIcon
"source.js.postcss": "javascript", // https://github.com/SublimeText/AFileIcon
"source.js.puglint": "javascript", // https://github.com/SublimeText/AFileIcon
"source.js.react": "javascriptreact", // https://github.com/Thom1729/Sublime-JS-Custom
"source.js.stylelint": "javascript", // https://github.com/SublimeText/AFileIcon
"source.js.unittest": "javascript", // https://github.com/SublimeText/AFileIcon
"source.js.webpack": "javascript", // https://github.com/SublimeText/AFileIcon
"source.json-tmlanguage": "jsonc", // https://github.com/SublimeText/PackageDev
"source.json.babel": "json", // https://github.com/SublimeText/AFileIcon
"source.json.bower": "json", // https://github.com/SublimeText/AFileIcon
"source.json.composer": "json", // https://github.com/SublimeText/AFileIcon
"source.json.eslint": "json", // https://github.com/SublimeText/AFileIcon
"source.json.npm": "json", // https://github.com/SublimeText/AFileIcon
"source.json.postcss": "json", // https://github.com/SublimeText/AFileIcon
"source.json.puglint": "json", // https://github.com/SublimeText/AFileIcon
"source.json.settings": "json", // https://github.com/SublimeText/AFileIcon
"source.json.stylelint": "json", // https://github.com/SublimeText/AFileIcon
"source.json.sublime": "jsonc", // https://github.com/SublimeText/PackageDev
"source.json.sublime.build": "jsonc", // https://github.com/SublimeText/PackageDev
"source.json.sublime.color-scheme": "jsonc", // https://github.com/SublimeText/PackageDev
"source.json.sublime.commands": "jsonc", // https://github.com/SublimeText/PackageDev
"source.json.sublime.completions": "jsonc", // https://github.com/SublimeText/PackageDev
"source.json.sublime.keymap": "jsonc", // https://github.com/SublimeText/PackageDev
"source.json.sublime.macro": "jsonc", // https://github.com/SublimeText/PackageDev
"source.json.sublime.menu": "jsonc", // https://github.com/SublimeText/PackageDev
"source.json.sublime.mousemap": "jsonc", // https://github.com/SublimeText/PackageDev
"source.json.sublime.project": "jsonc", // https://github.com/SublimeText/PackageDev
"source.json.sublime.settings": "jsonc", // https://github.com/SublimeText/PackageDev
"source.json.sublime.theme": "jsonc", // https://github.com/SublimeText/PackageDev
"source.json.tern": "json", // https://github.com/SublimeText/AFileIcon
"source.jsx": "javascriptreact",
"source.jsx.unittest": "javascriptreact", // https://github.com/SublimeText/AFileIcon
"source.Kotlin": "kotlin", // https://github.com/vkostyukov/kotlin-sublime-package
"source.modern-fortran": "fortran", // https://packagecontrol.io/packages/Fortran
"source.objc": "objective-c",
"source.objc++": "objective-cpp",
"source.shader": "shaderlab", // https://github.com/waqiju/unity_shader_st3
"source.shell.bash": "shellscript",
"source.shell.docker": "shellscript", // https://github.com/SublimeText/AFileIcon
"source.shell.eslint": "shellscript", // https://github.com/SublimeText/AFileIcon
"source.shell.npm": "shellscript", // https://github.com/SublimeText/AFileIcon
"source.shell.ruby": "shellscript", // https://github.com/SublimeText/AFileIcon
"source.shell.stylelint": "shellscript", // https://github.com/SublimeText/AFileIcon
"source.shell": "shellscript",
"source.ts": "typescript",
"source.ts.react": "typescriptreact", // https://github.com/Thom1729/Sublime-JS-Custom
"source.ts.unittest": "typescript", // https://github.com/SublimeText/AFileIcon
"source.tsx": "typescriptreact",
"source.tsx.unittest": "typescriptreact", // https://github.com/SublimeText/AFileIcon
"source.unity.unity_shader": "shaderlab", // https://github.com/petereichinger/Unity3D-Shader
"source.viml.vimrc": "viml", // https://github.com/SublimeText/AFileIcon
"source.yaml-tmlanguage": "yaml", // https://github.com/SublimeText/PackageDev
"source.yaml.circleci": "yaml", // https://github.com/SublimeText/AFileIcon
"source.yaml.docker": "yaml", // https://github.com/SublimeText/AFileIcon
"source.yaml.eslint": "yaml", // https://github.com/SublimeText/AFileIcon
"source.yaml.lock": "yaml", // https://github.com/SublimeText/AFileIcon
"source.yaml.procfile": "yaml", // https://github.com/SublimeText/AFileIcon
"source.yaml.stylelint": "yaml", // https://github.com/SublimeText/AFileIcon
"source.yaml.sublime.syntax": "yaml", // https://github.com/SublimeText/PackageDev
"source.yaml.yarn": "yaml", // https://github.com/SublimeText/AFileIcon
"text.advanced_csv": "csv", // https://github.com/SublimeText/AFileIcon
"text.django": "html", // https://github.com/willstott101/django-sublime-syntax
"text.html.basic": "html",
"text.html.elixir": "html", // https://github.com/elixir-editors/elixir-tmbundle
"text.html.markdown.academicmarkdown": "markdown", // https://github.com/mangecoeur/AcademicMarkdown
"text.html.markdown.license": "markdown", // https://github.com/SublimeText/AFileIcon
"text.html.handlebars": "handlebars",
"text.html.markdown": "markdown",
"text.html.markdown.rmarkdown": "r", // https://github.com/REditorSupport/sublime-ide-r
"text.html.ngx": "html", // https://github.com/princemaple/ngx-html-syntax
"text.html.vue": "vue",
"text.jinja": "html", // https://github.com/Sublime-Instincts/BetterJinja
"text.plain": "plaintext",
"text.plain.buildpacks": "plaintext", // https://github.com/SublimeText/AFileIcon
"text.plain.eslint": "plaintext", // https://github.com/SublimeText/AFileIcon
"text.plain.fastq": "plaintext", // https://github.com/SublimeText/AFileIcon
"text.plain.license": "plaintext", // https://github.com/SublimeText/AFileIcon
"text.plain.lnk": "plaintext", // https://github.com/SublimeText/AFileIcon
"text.plain.log": "plaintext", // https://github.com/SublimeText/AFileIcon
"text.plain.nodejs": "plaintext", // https://github.com/SublimeText/AFileIcon
"text.plain.pcb": "plaintext", // https://github.com/SublimeText/AFileIcon
"text.plain.ps": "plaintext", // https://github.com/SublimeText/AFileIcon
"text.plain.python": "plaintext", // https://github.com/SublimeText/AFileIcon
"text.plain.readme": "plaintext", // https://github.com/SublimeText/AFileIcon
"text.plain.ruby": "plaintext", // https://github.com/SublimeText/AFileIcon
"text.plain.sketch": "plaintext", // https://github.com/SublimeText/AFileIcon
"text.plain.visualstudio": "plaintext", // https://github.com/SublimeText/AFileIcon
"text.plist": "xml", // https://bitbucket.org/fschwehn/sublime_plist
"text.xml.plist": "xml", // https://github.com/SublimeText/PackageDev
"text.xml.plist.textmate.preferences": "xml", // https://github.com/SublimeText/PackageDev
"text.xml.sublime.snippet": "xml", // https://github.com/SublimeText/PackageDev
"text.xml.svg": "xml", // https://github.com/SublimeText/AFileIcon
"text.xml.visualstudio": "xml", // https://github.com/SublimeText/AFileIcon
"text.tex.latex": "latex",
"text.xml.xsl": "xsl",
}
24 changes: 12 additions & 12 deletions plugin/code_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,17 +365,17 @@ def actions_cache(self) -> List[Tuple[str, CodeAction]]:
def view(self) -> Optional[sublime.View]:
return self.window.active_view()

def is_enabled(self, id: int, event: Optional[dict] = None) -> bool:
if not -1 < id < len(self.actions_cache):
def is_enabled(self, index: int, event: Optional[dict] = None) -> bool:
if not -1 < index < len(self.actions_cache):
return False
return self._has_session(event)

def is_visible(self, id: int, event: Optional[dict] = None) -> bool:
if id == -1:
def is_visible(self, index: int, event: Optional[dict] = None) -> bool:
if index == -1:
if self._has_session(event):
sublime.set_timeout_async(partial(self._request_menu_actions_async, event))
return False
return id < len(self.actions_cache) and self._is_cache_valid(event)
return index < len(self.actions_cache) and self._is_cache_valid(event)

def _has_session(self, event: Optional[dict] = None) -> bool:
view = self.view
Expand All @@ -389,19 +389,19 @@ def _has_session(self, event: Optional[dict] = None) -> bool:
return False
return bool(listener.session_async(self.capability, region.b))

def description(self, id: int, event: Optional[dict] = None) -> Optional[str]:
if -1 < id < len(self.actions_cache):
return self.actions_cache[id][1]['title']
def description(self, index: int, event: Optional[dict] = None) -> Optional[str]:
if -1 < index < len(self.actions_cache):
return self.actions_cache[index][1]['title']

def want_event(self) -> bool:
return True

def run(self, id: int, event: Optional[dict] = None) -> None:
sublime.set_timeout_async(partial(self.run_async, id, event))
def run(self, index: int, event: Optional[dict] = None) -> None:
sublime.set_timeout_async(partial(self.run_async, index, event))

def run_async(self, id: int, event: Optional[dict]) -> None:
def run_async(self, index: int, event: Optional[dict]) -> None:
if self._is_cache_valid(event):
config_name, action = self.actions_cache[id]
config_name, action = self.actions_cache[index]
session = self.session_by_name(config_name)
if session:
session.run_code_action_async(action, progress=True, view=self.view) \
Expand Down
2 changes: 1 addition & 1 deletion plugin/code_lens.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def resolve_annotation(self, view_id: int) -> None:
def resolve(self, view: sublime.View, code_lens_or_error: Union[CodeLens, Error]) -> None:
if isinstance(code_lens_or_error, Error):
self.is_resolve_error = True
self.annotation = html_escape(str(code_lens_or_error))
self.annotation = '<span style="color: color(var(--redish)">error</span>'
return
self.data = code_lens_or_error
self.region = range_to_region(code_lens_or_error['range'], view)
Expand Down
2 changes: 1 addition & 1 deletion plugin/completion.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from .core.constants import COMPLETION_KINDS
from .core.edit import parse_text_edit
from .core.logging import debug
from .core.promise import Promise
Expand All @@ -19,7 +20,6 @@
from .core.sessions import Session
from .core.settings import userprefs
from .core.typing import Callable, List, Dict, Optional, Generator, Tuple, Union, cast, Any, TypeGuard
from .core.views import COMPLETION_KINDS
from .core.views import FORMAT_STRING, FORMAT_MARKUP_CONTENT
from .core.views import MarkdownLangMap
from .core.views import minihtml
Expand Down
Loading

0 comments on commit 4e61a81

Please sign in to comment.