Declare InitializeParams inside LS class

This commit is contained in:
Miguel de Benito Delgado committed 2025-06-29 10:07:00 +02:00
1 parent c3dd421ee8
commit 62f5985aa5
2 files changed
+38 -155

No files matched your search

@@ -86,28 +86,44 @@ class ClojureLSP(SolidLanguageServer):
return clojurelsp_executable_path
def _get_initialize_params(self, repository_absolute_path: str) -> InitializeParams:
"""
Returns the init params for clojure-lsp.
"""
with open(os.path.join(os.path.dirname(__file__), "initialize_params.json"), encoding="utf-8") as f:
d = json.load(f)
del d["_description"]
d["processId"] = os.getpid()
assert d["rootPath"] == "$rootPath"
d["rootPath"] = repository_absolute_path
assert d["rootUri"] == "$rootUri"
d["rootUri"] = pathlib.Path(repository_absolute_path).as_uri()
assert d["workspaceFolders"][0]["uri"] == "$uri"
d["workspaceFolders"][0]["uri"] = pathlib.Path(repository_absolute_path).as_uri()
assert d["workspaceFolders"][0]["name"] == "$name"
d["workspaceFolders"][0]["name"] = os.path.basename(repository_absolute_path)
return d
"""Returns the init params for clojure-lsp."""
root_uri = pathlib.Path(repository_absolute_path).as_uri()
return { # type: ignore
"processId": os.getpid(),
"rootPath": repository_absolute_path,
"rootUri": root_uri,
"clientInfo": {"name": "solidlsp", "version": "0.1.0"},
"capabilities": {
"workspace": {
"applyEdit": True,
"workspaceEdit": {"documentChanges": True},
"symbol": {
"symbolKind": {
"valueSet": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]
}
},
"workspaceFolders": True,
},
"textDocument": {
"synchronization": {"didSave": True},
"publishDiagnostics": {"relatedInformation": True, "tagSupport": {"valueSet": [1, 2]}},
"definition": {"linkSupport": True},
"references": {},
"completion": {"completionItem": {"snippetSupport": True, "documentationFormat": ["markdown", "plaintext"]}},
"hover": {"contentFormat": ["markdown", "plaintext"]},
"documentSymbol": {
"hierarchicalDocumentSymbolSupport": True,
"symbolKind": {
"valueSet": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]
},
},
},
"general": {"positionEncodings": ["utf-16"]},
},
"initializationOptions": {"dependency-scheme": "jar", "text-document-sync-kind": "incremental"},
"trace": "off",
"workspaceFolders": [{"uri": root_uri, "name": os.path.basename(repository_absolute_path)}],
}
def _start_server(self):
def register_capability_handler(params):
@@ -1,133 +0,0 @@
{
"_description": "Parameters sent by multilspy to initialize clojure-lsp (LSP v3.17)",
"processId": null,
"clientInfo": {
"name": "solidlsp",
"version": "0.1.0"
},
"rootUri": "$rootUri",
"rootPath": "$rootPath",
"capabilities": {
"workspace": {
"applyEdit": true,
"workspaceEdit": {
"documentChanges": true
},
"symbol": {
"symbolKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
]
}
},
"workspaceFolders": true
},
"textDocument": {
"synchronization": {
"didSave": true
},
"publishDiagnostics": {
"relatedInformation": true,
"tagSupport": {
"valueSet": [
1,
2
]
}
},
"definition": {
"linkSupport": true
},
"references": {},
"completion": {
"completionItem": {
"snippetSupport": true,
"documentationFormat": [
"markdown",
"plaintext"
]
}
},
"hover": {
"contentFormat": [
"markdown",
"plaintext"
]
},
"documentSymbol": {
"hierarchicalDocumentSymbolSupport": true,
"symbolKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
]
}
}
},
"general": {
"positionEncodings": [
"utf-16"
]
}
},
"initializationOptions": {
"dependency-scheme": "jar",
"text-document-sync-kind": "incremental"
},
"trace": "off",
"workspaceFolders": [
{
"uri": "$uri",
"name": "$name"
}
]
}