Skip to content

Commit 572638e

Browse files
committed
Merge branch 'main' into workspace-edit-preserve-tabs
2 parents 7b71db2 + c5321ad commit 572638e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+623
-514
lines changed

.github/workflows/main.yml

-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ jobs:
2424
runs-on: ${{ matrix.os }}
2525
steps:
2626
- uses: actions/checkout@v4
27-
- if: ${{ matrix.os == 'macOS-latest' }}
28-
run: brew unlink openssl
2927
- uses: SublimeText/UnitTesting/actions/setup@v1
3028
- uses: SublimeText/UnitTesting/actions/run-tests@v1
3129
with:

.python-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.8

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.29.0
1+
2.0.0

boot.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
from .plugin.core.transports import kill_all_subprocesses
3737
from .plugin.core.tree_view import LspCollapseTreeItemCommand
3838
from .plugin.core.tree_view import LspExpandTreeItemCommand
39-
from .plugin.core.typing import Any, Optional, List, Type, Dict
4039
from .plugin.core.views import LspRunTextCommandHelperCommand
4140
from .plugin.document_link import LspOpenLinkCommand
4241
from .plugin.documents import DocumentSyncListener
@@ -86,6 +85,7 @@
8685
from .plugin.tooling import LspOnDoubleClickCommand
8786
from .plugin.tooling import LspParseVscodePackageJson
8887
from .plugin.tooling import LspTroubleshootServerCommand
88+
from typing import Any, Dict, List, Optional, Type
8989

9090

9191
def _get_final_subclasses(derived: List[Type], results: List[Type]) -> None:
@@ -98,7 +98,7 @@ def _get_final_subclasses(derived: List[Type], results: List[Type]) -> None:
9898

9999

100100
def _register_all_plugins() -> None:
101-
plugin_classes = [] # type: List[Type[AbstractPlugin]]
101+
plugin_classes: List[Type[AbstractPlugin]] = []
102102
_get_final_subclasses(AbstractPlugin.__subclasses__(), plugin_classes)
103103
for plugin_class in plugin_classes:
104104
try:

dependencies.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
">=4096": [
44
"bracex",
55
"mdpopups",
6-
"pathlib",
6+
"typing_extensions",
77
"wcmatch"
88
]
99
}

docs/mkdocs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,4 @@ nav:
6666
extra:
6767
social:
6868
- icon: fontawesome/brands/discord
69-
link: https://discordapp.com/channels/280102180189634562/645268178397560865
69+
link: https://discord.gg/TZ5WN8t

docs/src/language_servers.md

+19-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ Follow installation instructions on [LSP-gopls](https://github.com/sublimelsp/LS
205205
"godot-lsp": {
206206
"enabled": true,
207207
"command": ["/PATH/TO/godot-editor.exe"], // Update the PATH
208-
"tcp_port": 6008,
208+
"tcp_port": 6005, // Older versions of Godot(3.x) use port 6008
209209
"selector": "source.gdscript",
210210
}
211211
}
@@ -673,6 +673,24 @@ Follow installation instructions on [LSP-metals](https://github.com/scalameta/me
673673
}
674674
```
675675

676+
## Solidity
677+
678+
1. Install the [Ethereum](https://packagecontrol.io/packages/Ethereum) package from Package Control for syntax highlighting.
679+
2. Install the [github:NomicFoundation/hardhat-vscode](https://github.com/NomicFoundation/hardhat-vscode/tree/development/server) language server.
680+
3. Open `Preferences > Package Settings > LSP > Settings` and add the `"solidity"` client configuration to the `"clients"`:
681+
682+
```jsonc
683+
{
684+
"clients": {
685+
"solidity": {
686+
"enabled": true,
687+
"command": ["nomicfoundation-solidity-language-server", "--stdio"],
688+
"selector": "source.solidity"
689+
}
690+
}
691+
}
692+
```
693+
676694
## Stylelint
677695

678696
Follow installation instructions on [LSP-stylelint](https://github.com/sublimelsp/LSP-stylelint).

messages.json

+2
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,14 @@
2929
"1.29.0": "messages/1.29.0.txt",
3030
"1.3.0": "messages/1.3.0.txt",
3131
"1.3.1": "messages/1.3.1.txt",
32+
"1.30.0": "messages/1.30.0.txt",
3233
"1.4.0": "messages/1.4.0.txt",
3334
"1.5.0": "messages/1.5.0.txt",
3435
"1.6.0": "messages/1.6.0.txt",
3536
"1.6.1": "messages/1.6.1.txt",
3637
"1.7.0": "messages/1.7.0.txt",
3738
"1.8.0": "messages/1.8.0.txt",
3839
"1.9.0": "messages/1.9.0.txt",
40+
"2.0.0": "messages/2.0.0.txt",
3941
"install": "messages/install.txt"
4042
}

messages/1.30.0.txt

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
=> 1.30.0
2+
3+
# Breaking changes
4+
5+
- [godot-editor](https://lsp.sublimetext.io/language_servers/#gdscript-godot-engine) client configuration default `tcp_port` value is now `6005` instead of `6008`. Older versions of Godot(3.x) use port `6008`. (#2447) (Предраг Николић)
6+
7+
# Fixes and Improvements
8+
9+
- Keep tab selection and focus when applying WorkspaceEdit (#2431) (Janos Wortmann)
10+
- Enhancements for the rename panel (#2428) (Janos Wortmann)
11+
- Fix URI format for res scheme (#2432) (Janos Wortmann)
12+
- If `"log_debug"` is enabled, `window/logMessage` will be printed to the Sublime Text Console instead of LSP log panel (#2444) (Janos Wortmann)
13+
14+
# Documentation
15+
16+
- docs: Add Toit (#2425) (Serjan Nasredin)
17+
- docs: Add Solidity (#2383) (Nikita Kozlov)
18+
19+
# Plugin API changes
20+
21+
- Allow plugins to ignore certain views (#2410) (Janos Wortmann)

messages/2.0.0.txt

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
=> 2.0.0
2+
3+
⚠️ Sublime Text will need to be restarted **more than once** for things to work properly. ⚠️
4+
5+
# Breaking changes
6+
7+
- LSP and LSP-* packages are transitioning from Python 3.3 to Python 3.8.
8+
9+
# FAQ
10+
11+
### What are the most significant improvements that stem from the 3.3 to 3.8 change?
12+
13+
There are no new features.
14+
This is an internal LSP codebase change that affects all LSP-* packages.
15+
16+
### LSP is broken after the update even if Sublime Text is restarted many times
17+
18+
If that is the case, follow these steps:
19+
20+
- ##### Check if `"index_files"` is set to `false` in `Preferences.sublime-settings`
21+
22+
From the command palette open `Preferences: Settings` and see if `"index_files": false` exists.
23+
If yes, remove that setting.
24+
25+
- ##### Check if `"LSP"` is put in `"ignored_packages"` in `Preferences.sublime-settings`
26+
27+
Ensure that LSP hasn't been added to the "ignored_packages" list during the update. If it has, remove it.
28+
29+
- ##### Reach for help
30+
31+
Feel free to [open an issue](https://github.com/sublimelsp/LSP/issues/new?assignees=&labels=&projects=&template=bug_report.md&title=) or reach out to us on [Discord](https://discord.gg/TZ5WN8t) if you encounter any problems during the update.
32+
Please provide logs from the Sublime Text console.

plugin/code_actions.py

+14-12
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from .core.sessions import AbstractViewListener
1212
from .core.sessions import SessionBufferProtocol
1313
from .core.settings import userprefs
14-
from .core.typing import Any, List, Dict, Callable, Optional, Tuple, TypeGuard, Union, cast
1514
from .core.views import entire_content_region
1615
from .core.views import first_selection_region
1716
from .core.views import format_code_actions_for_quick_panel
@@ -21,6 +20,9 @@
2120
from abc import ABCMeta
2221
from abc import abstractmethod
2322
from functools import partial
23+
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
24+
from typing import cast
25+
from typing_extensions import TypeGuard
2426
import sublime
2527

2628
ConfigName = str
@@ -37,10 +39,10 @@ class CodeActionsManager:
3739
"""Manager for per-location caching of code action responses."""
3840

3941
def __init__(self) -> None:
40-
self._response_cache = None # type: Optional[Tuple[str, Promise[List[CodeActionsByConfigName]]]]
41-
self.menu_actions_cache_key = None # type: Optional[str]
42-
self.refactor_actions_cache = [] # type: List[Tuple[str, CodeAction]]
43-
self.source_actions_cache = [] # type: List[Tuple[str, CodeAction]]
42+
self._response_cache: Optional[Tuple[str, Promise[List[CodeActionsByConfigName]]]] = None
43+
self.menu_actions_cache_key: Optional[str] = None
44+
self.refactor_actions_cache: List[Tuple[str, CodeAction]] = []
45+
self.source_actions_cache: List[Tuple[str, CodeAction]] = []
4446

4547
def request_for_region_async(
4648
self,
@@ -74,7 +76,7 @@ def request_for_region_async(
7476
self.source_actions_cache.clear()
7577

7678
def request_factory(sb: SessionBufferProtocol) -> Optional[Request]:
77-
diagnostics = [] # type: List[Diagnostic]
79+
diagnostics: List[Diagnostic] = []
7880
for diag_sb, diags in session_buffer_diagnostics:
7981
if diag_sb == sb:
8082
diagnostics = diags
@@ -122,7 +124,7 @@ def request_factory(sb: SessionBufferProtocol) -> Optional[Request]:
122124
matching_kinds = get_matching_on_save_kinds(on_save_actions, session_kinds)
123125
if not matching_kinds:
124126
return None
125-
diagnostics = [] # type: List[Diagnostic]
127+
diagnostics: List[Diagnostic] = []
126128
for diag_sb, diags in session_buffer_diagnostics:
127129
if diag_sb == sb:
128130
diagnostics = diags
@@ -155,13 +157,13 @@ def on_response(
155157
actions = response_filter(sb, response)
156158
return (sb.session.config.name, actions)
157159

158-
tasks = [] # type: List[Promise[CodeActionsByConfigName]]
160+
tasks: List[Promise[CodeActionsByConfigName]] = []
159161
for sb in listener.session_buffers_async('codeActionProvider'):
160162
session = sb.session
161163
request = request_factory(sb)
162164
if request:
163165
response_handler = partial(on_response, sb)
164-
task = session.send_request_task(request) # type: Promise[Optional[List[CodeActionOrCommand]]]
166+
task: Promise[Optional[List[CodeActionOrCommand]]] = session.send_request_task(request)
165167
tasks.append(task.then(response_handler))
166168
# Return only results for non-empty lists.
167169
return Promise.all(tasks) \
@@ -172,7 +174,7 @@ def on_response(
172174

173175

174176
def get_session_kinds(sb: SessionBufferProtocol) -> List[CodeActionKind]:
175-
session_kinds = sb.get_capability('codeActionProvider.codeActionKinds') # type: Optional[List[CodeActionKind]]
177+
session_kinds: Optional[List[CodeActionKind]] = sb.get_capability('codeActionProvider.codeActionKinds')
176178
return session_kinds or []
177179

178180

@@ -254,7 +256,7 @@ def _handle_response_async(self, responses: List[CodeActionsByConfigName]) -> No
254256
if self._cancelled:
255257
return
256258
view = self._task_runner.view
257-
tasks = [] # type: List[Promise]
259+
tasks: List[Promise] = []
258260
for config_name, code_actions in responses:
259261
session = self._task_runner.session_by_name(config_name, 'codeActionProvider')
260262
if session:
@@ -308,7 +310,7 @@ def _run_async(self, only_kinds: Optional[List[CodeActionKind]] = None) -> None:
308310

309311
def _handle_code_actions(self, response: List[CodeActionsByConfigName], run_first: bool = False) -> None:
310312
# Flatten response to a list of (config_name, code_action) tuples.
311-
actions = [] # type: List[Tuple[ConfigName, CodeActionOrCommand]]
313+
actions: List[Tuple[ConfigName, CodeActionOrCommand]] = []
312314
for config_name, session_actions in response:
313315
actions.extend([(config_name, action) for action in session_actions])
314316
if actions:

plugin/code_lens.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
from .core.protocol import CodeLens
33
from .core.protocol import CodeLensExtended
44
from .core.protocol import Error
5-
from .core.typing import List, Tuple, Dict, Iterable, Optional, Generator, Union, cast
65
from .core.registry import LspTextCommand
76
from .core.registry import LspWindowCommand
87
from .core.registry import windows
98
from .core.views import make_command_link
109
from .core.views import range_to_region
1110
from html import escape as html_escape
1211
from functools import partial
12+
from typing import Dict, Generator, Iterable, List, Optional, Tuple, Union
13+
from typing import cast
1314
import itertools
1415
import sublime
1516

@@ -108,7 +109,7 @@ def __init__(self, view: sublime.View) -> None:
108109
self.view = view
109110
self._init = False
110111
self._phantom = sublime.PhantomSet(view, self.CODE_LENS_KEY)
111-
self._code_lenses = {} # type: Dict[Tuple[int, int], List[CodeLensData]]
112+
self._code_lenses: Dict[Tuple[int, int], List[CodeLensData]] = {}
112113

113114
def clear(self) -> None:
114115
self._code_lenses.clear()
@@ -134,10 +135,10 @@ def handle_response(self, session_name: str, response: List[CodeLens]) -> None:
134135
self._init = True
135136
responses = [CodeLensData(data, self.view, session_name) for data in response]
136137
responses.sort(key=lambda c: c.region)
137-
result = {
138+
result: Dict[Tuple[int, int], List[CodeLensData]] = {
138139
region.to_tuple(): list(groups)
139140
for region, groups in itertools.groupby(responses, key=lambda c: c.region)
140-
} # type: Dict[Tuple[int, int], List[CodeLensData]]
141+
}
141142

142143
# Fast path: no extra work to do
143144
if self.is_empty():
@@ -215,7 +216,7 @@ def run(self, edit: sublime.Edit) -> None:
215216
listener = windows.listener_for_view(self.view)
216217
if not listener:
217218
return
218-
code_lenses = [] # type: List[CodeLensExtended]
219+
code_lenses: List[CodeLensExtended] = []
219220
for region in self.view.sel():
220221
for sv in listener.session_views_async():
221222
code_lenses.extend(sv.get_resolved_code_lenses_for_region(region))

plugin/color.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
from .core.protocol import ColorPresentationParams
55
from .core.protocol import Request
66
from .core.registry import LspTextCommand
7-
from .core.typing import List
87
from .core.views import range_to_region
98
from .core.views import text_document_identifier
9+
from typing import List
1010
import sublime
1111

1212

@@ -19,11 +19,11 @@ def run(self, edit: sublime.Edit, color_information: ColorInformation) -> None:
1919
if session:
2020
self._version = self.view.change_count()
2121
self._range = color_information['range']
22-
params = {
22+
params: ColorPresentationParams = {
2323
'textDocument': text_document_identifier(self.view),
2424
'color': color_information['color'],
2525
'range': self._range
26-
} # type: ColorPresentationParams
26+
}
2727
session.send_request_async(Request.colorPresentation(params, self.view), self._handle_response_async)
2828

2929
def want_event(self) -> bool:
@@ -38,7 +38,7 @@ def _handle_response_async(self, response: List[ColorPresentation]) -> None:
3838
if self._version != self.view.change_count():
3939
return
4040
old_text = self.view.substr(range_to_region(self._range, self.view))
41-
self._filtered_response = [] # type: List[ColorPresentation]
41+
self._filtered_response: List[ColorPresentation] = []
4242
for item in response:
4343
# Filter out items that would apply no change
4444
text_edit = item.get('textEdit')

0 commit comments

Comments
 (0)