Skip to content

Commit

Permalink
feat: update to latest lsprotocol 2024.0.0a2
Browse files Browse the repository at this point in the history
  • Loading branch information
karthiknadig committed Aug 13, 2024
1 parent 0f6005c commit 8d4dcaf
Show file tree
Hide file tree
Showing 19 changed files with 639 additions and 554 deletions.
6 changes: 3 additions & 3 deletions docs/source/user-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ Depending on how the handler is registered (see :ref:`here <ls-handlers>`) you c
# await keyword tells event loop to switch to another task until notification is received
config = await ls.get_configuration(
WorkspaceConfigurationParams(
ConfigurationParams(
items=[
ConfigurationItem(scope_uri='doc_uri_here', section='section')
]
Expand All @@ -367,7 +367,7 @@ Depending on how the handler is registered (see :ref:`here <ls-handlers>`) you c
def callback(config):
# Omitted
params = WorkspaceConfigurationParams(
params = ConfigurationParams(
items=[
ConfigurationItem(scope_uri='doc_uri_here', section='section')
]
Expand All @@ -380,7 +380,7 @@ Depending on how the handler is registered (see :ref:`here <ls-handlers>`) you c
# .result() will block the thread
config = ls.get_configuration(
WorkspaceConfigurationParams(
ConfigurationParams(
items=[
ConfigurationItem(scope_uri='doc_uri_here', section='section')
]
Expand Down
6 changes: 3 additions & 3 deletions examples/servers/json_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ async def show_configuration_async(ls: JsonLanguageServer, *args):
"""Gets exampleConfiguration from the client settings using coroutines."""
try:
config = await ls.get_configuration_async(
lsp.WorkspaceConfigurationParams(
lsp.ConfigurationParams(
items=[
lsp.ConfigurationItem(
scope_uri="", section=JsonLanguageServer.CONFIGURATION_SECTION
Expand Down Expand Up @@ -292,7 +292,7 @@ def _config_callback(config):
ls.show_message_log(f"Error ocurred: {e}")

ls.get_configuration(
lsp.WorkspaceConfigurationParams(
lsp.ConfigurationParams(
items=[
lsp.ConfigurationItem(
scope_uri="", section=JsonLanguageServer.CONFIGURATION_SECTION
Expand All @@ -309,7 +309,7 @@ def show_configuration_thread(ls: JsonLanguageServer, *args):
"""Gets exampleConfiguration from the client settings using thread pool."""
try:
config = ls.get_configuration(
lsp.WorkspaceConfigurationParams(
lsp.ConfigurationParams(
items=[
lsp.ConfigurationItem(
scope_uri="", section=JsonLanguageServer.CONFIGURATION_SECTION
Expand Down
2 changes: 1 addition & 1 deletion examples/servers/rename.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def prepare_rename(ls: RenameLanguageServer, params: types.PrepareRenameParams):
# For simplicity we can tell the client to use its default behaviour however, it's
# relatively new to the spec (LSP v3.16+) so a production server should check the
# client's capabilities before responding in this way
return types.PrepareRenameResult_Type2(default_behavior=True)
return types.PrepareRenameDefaultBehavior(default_behavior=True)


if __name__ == "__main__":
Expand Down
850 changes: 452 additions & 398 deletions poetry.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions pygls/capabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,12 +326,12 @@ def _with_semantic_tokens(self):
self.server_cap.semantic_tokens_provider = value
return self

full_support: Union[bool, types.SemanticTokensOptionsFullType1] = (
full_support: Union[bool, types.SemanticTokensFullDelta] = (
types.TEXT_DOCUMENT_SEMANTIC_TOKENS_FULL in self.features
)

if types.TEXT_DOCUMENT_SEMANTIC_TOKENS_FULL_DELTA in self.features:
full_support = types.SemanticTokensOptionsFullType1(delta=True)
full_support = types.SemanticTokensFullDelta(delta=True)

options = types.SemanticTokensOptions(
legend=value,
Expand Down Expand Up @@ -388,7 +388,7 @@ def _with_workspace_capabilities(self):
value = self._provider_options(method_name, default=None)
setattr(file_operations, capability_name, value)

self.server_cap.workspace = types.ServerCapabilitiesWorkspaceType(
self.server_cap.workspace = types.WorkspaceOptions(
workspace_folders=types.WorkspaceFoldersServerCapabilities(
supported=True,
change_notifications=True,
Expand Down
Loading

0 comments on commit 8d4dcaf

Please sign in to comment.