@nogataka/smart-edit 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +244 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +7 -0
- package/dist/devtools/generate_prompt_factory.d.ts +5 -0
- package/dist/devtools/generate_prompt_factory.js +114 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.js +34 -0
- package/dist/interprompt/index.d.ts +2 -0
- package/dist/interprompt/index.js +1 -0
- package/dist/interprompt/jinja_template.d.ts +10 -0
- package/dist/interprompt/jinja_template.js +174 -0
- package/dist/interprompt/multilang_prompt.d.ts +54 -0
- package/dist/interprompt/multilang_prompt.js +302 -0
- package/dist/interprompt/prompt_factory.d.ts +16 -0
- package/dist/interprompt/prompt_factory.js +189 -0
- package/dist/interprompt/util/class_decorators.d.ts +1 -0
- package/dist/interprompt/util/class_decorators.js +1 -0
- package/dist/interprompt/util/index.d.ts +1 -0
- package/dist/interprompt/util/index.js +1 -0
- package/dist/serena/agent.d.ts +118 -0
- package/dist/serena/agent.js +675 -0
- package/dist/serena/agno.d.ts +111 -0
- package/dist/serena/agno.js +278 -0
- package/dist/serena/analytics.d.ts +24 -0
- package/dist/serena/analytics.js +119 -0
- package/dist/serena/cli.d.ts +9 -0
- package/dist/serena/cli.js +731 -0
- package/dist/serena/code_editor.d.ts +42 -0
- package/dist/serena/code_editor.js +239 -0
- package/dist/serena/config/context_mode.d.ts +41 -0
- package/dist/serena/config/context_mode.js +239 -0
- package/dist/serena/config/serena_config.d.ts +134 -0
- package/dist/serena/config/serena_config.js +718 -0
- package/dist/serena/constants.d.ts +18 -0
- package/dist/serena/constants.js +27 -0
- package/dist/serena/dashboard.d.ts +55 -0
- package/dist/serena/dashboard.js +472 -0
- package/dist/serena/generated/generated_prompt_factory.d.ts +27 -0
- package/dist/serena/generated/generated_prompt_factory.js +42 -0
- package/dist/serena/gui_log_viewer.d.ts +41 -0
- package/dist/serena/gui_log_viewer.js +436 -0
- package/dist/serena/mcp.d.ts +118 -0
- package/dist/serena/mcp.js +904 -0
- package/dist/serena/project.d.ts +62 -0
- package/dist/serena/project.js +321 -0
- package/dist/serena/prompt_factory.d.ts +20 -0
- package/dist/serena/prompt_factory.js +42 -0
- package/dist/serena/resources/config/contexts/agent.yml +8 -0
- package/dist/serena/resources/config/contexts/chatgpt.yml +28 -0
- package/dist/serena/resources/config/contexts/codex.yml +27 -0
- package/dist/serena/resources/config/contexts/context.template.yml +11 -0
- package/dist/serena/resources/config/contexts/desktop-app.yml +17 -0
- package/dist/serena/resources/config/contexts/ide-assistant.yml +26 -0
- package/dist/serena/resources/config/contexts/oaicompat-agent.yml +8 -0
- package/dist/serena/resources/config/internal_modes/jetbrains.yml +15 -0
- package/dist/serena/resources/config/modes/editing.yml +112 -0
- package/dist/serena/resources/config/modes/interactive.yml +11 -0
- package/dist/serena/resources/config/modes/mode.template.yml +7 -0
- package/dist/serena/resources/config/modes/no-onboarding.yml +8 -0
- package/dist/serena/resources/config/modes/onboarding.yml +16 -0
- package/dist/serena/resources/config/modes/one-shot.yml +15 -0
- package/dist/serena/resources/config/modes/planning.yml +15 -0
- package/dist/serena/resources/config/prompt_templates/simple_tool_outputs.yml +75 -0
- package/dist/serena/resources/config/prompt_templates/system_prompt.yml +66 -0
- package/dist/serena/resources/dashboard/dashboard.js +815 -0
- package/dist/serena/resources/dashboard/index.html +314 -0
- package/dist/serena/resources/dashboard/jquery.min.js +3 -0
- package/dist/serena/resources/dashboard/serena-icon-16.png +0 -0
- package/dist/serena/resources/dashboard/serena-icon-32.png +0 -0
- package/dist/serena/resources/dashboard/serena-icon-48.png +0 -0
- package/dist/serena/resources/dashboard/serena-logs-dark-mode.png +0 -0
- package/dist/serena/resources/dashboard/serena-logs.png +0 -0
- package/dist/serena/resources/project.template.yml +67 -0
- package/dist/serena/resources/serena_config.template.yml +85 -0
- package/dist/serena/symbol.d.ts +199 -0
- package/dist/serena/symbol.js +616 -0
- package/dist/serena/text_utils.d.ts +51 -0
- package/dist/serena/text_utils.js +267 -0
- package/dist/serena/tools/cmd_tools.d.ts +31 -0
- package/dist/serena/tools/cmd_tools.js +48 -0
- package/dist/serena/tools/config_tools.d.ts +53 -0
- package/dist/serena/tools/config_tools.js +176 -0
- package/dist/serena/tools/file_tools.d.ts +231 -0
- package/dist/serena/tools/file_tools.js +511 -0
- package/dist/serena/tools/index.d.ts +7 -0
- package/dist/serena/tools/index.js +7 -0
- package/dist/serena/tools/memory_tools.d.ts +60 -0
- package/dist/serena/tools/memory_tools.js +135 -0
- package/dist/serena/tools/symbol_tools.d.ts +165 -0
- package/dist/serena/tools/symbol_tools.js +362 -0
- package/dist/serena/tools/tools_base.d.ts +162 -0
- package/dist/serena/tools/tools_base.js +378 -0
- package/dist/serena/tools/workflow_tools.d.ts +35 -0
- package/dist/serena/tools/workflow_tools.js +161 -0
- package/dist/serena/util/class_decorators.d.ts +7 -0
- package/dist/serena/util/class_decorators.js +37 -0
- package/dist/serena/util/exception.d.ts +8 -0
- package/dist/serena/util/exception.js +53 -0
- package/dist/serena/util/file_system.d.ts +30 -0
- package/dist/serena/util/file_system.js +352 -0
- package/dist/serena/util/general.d.ts +11 -0
- package/dist/serena/util/general.js +42 -0
- package/dist/serena/util/git.d.ts +11 -0
- package/dist/serena/util/git.js +37 -0
- package/dist/serena/util/inspection.d.ts +45 -0
- package/dist/serena/util/inspection.js +221 -0
- package/dist/serena/util/logging.d.ts +46 -0
- package/dist/serena/util/logging.js +205 -0
- package/dist/serena/util/shell.d.ts +21 -0
- package/dist/serena/util/shell.js +95 -0
- package/dist/serena/util/thread.d.ts +23 -0
- package/dist/serena/util/thread.js +88 -0
- package/dist/serena/version.d.ts +1 -0
- package/dist/serena/version.js +23 -0
- package/dist/solidlsp/language_servers/autoload.d.ts +23 -0
- package/dist/solidlsp/language_servers/autoload.js +25 -0
- package/dist/solidlsp/language_servers/bash_language_server.d.ts +10 -0
- package/dist/solidlsp/language_servers/bash_language_server.js +64 -0
- package/dist/solidlsp/language_servers/clangd_language_server.d.ts +13 -0
- package/dist/solidlsp/language_servers/clangd_language_server.js +110 -0
- package/dist/solidlsp/language_servers/clojure_lsp.d.ts +13 -0
- package/dist/solidlsp/language_servers/clojure_lsp.js +137 -0
- package/dist/solidlsp/language_servers/common.d.ts +41 -0
- package/dist/solidlsp/language_servers/common.js +365 -0
- package/dist/solidlsp/language_servers/csharp_language_server.d.ts +21 -0
- package/dist/solidlsp/language_servers/csharp_language_server.js +694 -0
- package/dist/solidlsp/language_servers/dart_language_server.d.ts +10 -0
- package/dist/solidlsp/language_servers/dart_language_server.js +122 -0
- package/dist/solidlsp/language_servers/eclipse_jdtls.d.ts +24 -0
- package/dist/solidlsp/language_servers/eclipse_jdtls.js +671 -0
- package/dist/solidlsp/language_servers/erlang_language_server.d.ts +22 -0
- package/dist/solidlsp/language_servers/erlang_language_server.js +327 -0
- package/dist/solidlsp/language_servers/gopls.d.ts +12 -0
- package/dist/solidlsp/language_servers/gopls.js +59 -0
- package/dist/solidlsp/language_servers/intelephense.d.ts +13 -0
- package/dist/solidlsp/language_servers/intelephense.js +121 -0
- package/dist/solidlsp/language_servers/jedi_server.d.ts +18 -0
- package/dist/solidlsp/language_servers/jedi_server.js +234 -0
- package/dist/solidlsp/language_servers/kotlin_language_server.d.ts +19 -0
- package/dist/solidlsp/language_servers/kotlin_language_server.js +474 -0
- package/dist/solidlsp/language_servers/lua_ls.d.ts +18 -0
- package/dist/solidlsp/language_servers/lua_ls.js +319 -0
- package/dist/solidlsp/language_servers/nixd_language_server.d.ts +17 -0
- package/dist/solidlsp/language_servers/nixd_language_server.js +341 -0
- package/dist/solidlsp/language_servers/pyright_server.d.ts +19 -0
- package/dist/solidlsp/language_servers/pyright_server.js +180 -0
- package/dist/solidlsp/language_servers/r_language_server.d.ts +19 -0
- package/dist/solidlsp/language_servers/r_language_server.js +184 -0
- package/dist/solidlsp/language_servers/ruby_common.d.ts +10 -0
- package/dist/solidlsp/language_servers/ruby_common.js +136 -0
- package/dist/solidlsp/language_servers/ruby_lsp.d.ts +18 -0
- package/dist/solidlsp/language_servers/ruby_lsp.js +230 -0
- package/dist/solidlsp/language_servers/rust_analyzer.d.ts +13 -0
- package/dist/solidlsp/language_servers/rust_analyzer.js +96 -0
- package/dist/solidlsp/language_servers/solargraph.d.ts +18 -0
- package/dist/solidlsp/language_servers/solargraph.js +208 -0
- package/dist/solidlsp/language_servers/sourcekit_lsp.d.ts +24 -0
- package/dist/solidlsp/language_servers/sourcekit_lsp.js +449 -0
- package/dist/solidlsp/language_servers/terraform_ls.d.ts +13 -0
- package/dist/solidlsp/language_servers/terraform_ls.js +139 -0
- package/dist/solidlsp/language_servers/typescript_language_server.d.ts +20 -0
- package/dist/solidlsp/language_servers/typescript_language_server.js +237 -0
- package/dist/solidlsp/language_servers/vts_language_server.d.ts +13 -0
- package/dist/solidlsp/language_servers/vts_language_server.js +121 -0
- package/dist/solidlsp/language_servers/zls.d.ts +20 -0
- package/dist/solidlsp/language_servers/zls.js +254 -0
- package/dist/solidlsp/ls.d.ts +197 -0
- package/dist/solidlsp/ls.js +507 -0
- package/dist/solidlsp/ls_config.d.ts +43 -0
- package/dist/solidlsp/ls_config.js +157 -0
- package/dist/solidlsp/ls_exceptions.d.ts +5 -0
- package/dist/solidlsp/ls_exceptions.js +14 -0
- package/dist/solidlsp/ls_handler.d.ts +54 -0
- package/dist/solidlsp/ls_handler.js +406 -0
- package/dist/solidlsp/ls_request.d.ts +31 -0
- package/dist/solidlsp/ls_request.js +42 -0
- package/dist/solidlsp/ls_types.d.ts +7 -0
- package/dist/solidlsp/ls_types.js +8 -0
- package/dist/solidlsp/lsp_protocol_handler/server.d.ts +61 -0
- package/dist/solidlsp/lsp_protocol_handler/server.js +68 -0
- package/dist/solidlsp/util/subprocess_util.d.ts +6 -0
- package/dist/solidlsp/util/subprocess_util.js +11 -0
- package/dist/solidlsp/util/zip.d.ts +25 -0
- package/dist/solidlsp/util/zip.js +188 -0
- package/package.json +65 -0
|
@@ -0,0 +1,671 @@
|
|
|
1
|
+
import crypto from 'node:crypto';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { pathToFileURL } from 'node:url';
|
|
5
|
+
import { createSerenaLogger } from '../../serena/util/logging.js';
|
|
6
|
+
import { Language } from '../ls_config.js';
|
|
7
|
+
import { SolidLanguageServer, SolidLspSettings, registerLanguageServer, coerceLogLevel } from '../ls.js';
|
|
8
|
+
import { NodeLanguageServerHandler } from '../ls_handler.js';
|
|
9
|
+
import { RuntimeDependencyCollection } from './common.js';
|
|
10
|
+
const GRADLE_VERSION = '8.14.2';
|
|
11
|
+
const INTELLICODE_VERSION = '1.2.30';
|
|
12
|
+
const VSCODE_JAVA_VERSION = '1.42.0';
|
|
13
|
+
const GRADLE_DEPENDENCY = {
|
|
14
|
+
id: 'gradle',
|
|
15
|
+
url: `https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip`,
|
|
16
|
+
archiveType: 'zip'
|
|
17
|
+
};
|
|
18
|
+
const VSCODE_JAVA_DEPENDENCIES = {
|
|
19
|
+
'osx-arm64': {
|
|
20
|
+
id: 'vscode-java',
|
|
21
|
+
url: `https://github.com/redhat-developer/vscode-java/releases/download/v${VSCODE_JAVA_VERSION}/java-darwin-arm64-${VSCODE_JAVA_VERSION}-561.vsix`,
|
|
22
|
+
archiveType: 'zip',
|
|
23
|
+
relativeExtractionPath: 'vscode-java',
|
|
24
|
+
jreHomePath: 'extension/jre/21.0.7-macosx-aarch64',
|
|
25
|
+
jreBinaryPath: 'extension/jre/21.0.7-macosx-aarch64/bin/java',
|
|
26
|
+
lombokJarPath: 'extension/lombok/lombok-1.18.36.jar',
|
|
27
|
+
launcherJarPath: 'extension/server/plugins/org.eclipse.equinox.launcher_1.7.0.v20250424-1814.jar',
|
|
28
|
+
readonlyConfigPath: 'extension/server/config_mac_arm'
|
|
29
|
+
},
|
|
30
|
+
'darwin-arm64': {
|
|
31
|
+
id: 'vscode-java',
|
|
32
|
+
url: `https://github.com/redhat-developer/vscode-java/releases/download/v${VSCODE_JAVA_VERSION}/java-darwin-arm64-${VSCODE_JAVA_VERSION}-561.vsix`,
|
|
33
|
+
archiveType: 'zip',
|
|
34
|
+
relativeExtractionPath: 'vscode-java',
|
|
35
|
+
jreHomePath: 'extension/jre/21.0.7-macosx-aarch64',
|
|
36
|
+
jreBinaryPath: 'extension/jre/21.0.7-macosx-aarch64/bin/java',
|
|
37
|
+
lombokJarPath: 'extension/lombok/lombok-1.18.36.jar',
|
|
38
|
+
launcherJarPath: 'extension/server/plugins/org.eclipse.equinox.launcher_1.7.0.v20250424-1814.jar',
|
|
39
|
+
readonlyConfigPath: 'extension/server/config_mac_arm'
|
|
40
|
+
},
|
|
41
|
+
'osx-x64': {
|
|
42
|
+
id: 'vscode-java',
|
|
43
|
+
url: `https://github.com/redhat-developer/vscode-java/releases/download/v${VSCODE_JAVA_VERSION}/java-darwin-x64-${VSCODE_JAVA_VERSION}-561.vsix`,
|
|
44
|
+
archiveType: 'zip',
|
|
45
|
+
relativeExtractionPath: 'vscode-java',
|
|
46
|
+
jreHomePath: 'extension/jre/21.0.7-macosx-x86_64',
|
|
47
|
+
jreBinaryPath: 'extension/jre/21.0.7-macosx-x86_64/bin/java',
|
|
48
|
+
lombokJarPath: 'extension/lombok/lombok-1.18.36.jar',
|
|
49
|
+
launcherJarPath: 'extension/server/plugins/org.eclipse.equinox.launcher_1.7.0.v20250424-1814.jar',
|
|
50
|
+
readonlyConfigPath: 'extension/server/config_mac'
|
|
51
|
+
},
|
|
52
|
+
'linux-x64': {
|
|
53
|
+
id: 'vscode-java',
|
|
54
|
+
url: `https://github.com/redhat-developer/vscode-java/releases/download/v${VSCODE_JAVA_VERSION}/java-linux-x64-${VSCODE_JAVA_VERSION}-561.vsix`,
|
|
55
|
+
archiveType: 'zip',
|
|
56
|
+
relativeExtractionPath: 'vscode-java',
|
|
57
|
+
jreHomePath: 'extension/jre/21.0.7-linux-x86_64',
|
|
58
|
+
jreBinaryPath: 'extension/jre/21.0.7-linux-x86_64/bin/java',
|
|
59
|
+
lombokJarPath: 'extension/lombok/lombok-1.18.36.jar',
|
|
60
|
+
launcherJarPath: 'extension/server/plugins/org.eclipse.equinox.launcher_1.7.0.v20250424-1814.jar',
|
|
61
|
+
readonlyConfigPath: 'extension/server/config_linux'
|
|
62
|
+
},
|
|
63
|
+
'linux-arm64': {
|
|
64
|
+
id: 'vscode-java',
|
|
65
|
+
url: `https://github.com/redhat-developer/vscode-java/releases/download/v${VSCODE_JAVA_VERSION}/java-linux-arm64-${VSCODE_JAVA_VERSION}-561.vsix`,
|
|
66
|
+
archiveType: 'zip',
|
|
67
|
+
relativeExtractionPath: 'vscode-java',
|
|
68
|
+
jreHomePath: 'extension/jre/21.0.7-linux-aarch64',
|
|
69
|
+
jreBinaryPath: 'extension/jre/21.0.7-linux-aarch64/bin/java',
|
|
70
|
+
lombokJarPath: 'extension/lombok/lombok-1.18.36.jar',
|
|
71
|
+
launcherJarPath: 'extension/server/plugins/org.eclipse.equinox.launcher_1.7.0.v20250424-1814.jar',
|
|
72
|
+
readonlyConfigPath: 'extension/server/config_linux'
|
|
73
|
+
},
|
|
74
|
+
'win-x64': {
|
|
75
|
+
id: 'vscode-java',
|
|
76
|
+
url: `https://github.com/redhat-developer/vscode-java/releases/download/v${VSCODE_JAVA_VERSION}/java-win32-x64-${VSCODE_JAVA_VERSION}-561.vsix`,
|
|
77
|
+
archiveType: 'zip',
|
|
78
|
+
relativeExtractionPath: 'vscode-java',
|
|
79
|
+
jreHomePath: 'extension/jre/21.0.7-win32-x86_64',
|
|
80
|
+
jreBinaryPath: 'extension/jre/21.0.7-win32-x86_64/bin/java.exe',
|
|
81
|
+
lombokJarPath: 'extension/lombok/lombok-1.18.36.jar',
|
|
82
|
+
launcherJarPath: 'extension/server/plugins/org.eclipse.equinox.launcher_1.7.0.v20250424-1814.jar',
|
|
83
|
+
readonlyConfigPath: 'extension/server/config_win'
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
const INTELLICODE_DEPENDENCY = {
|
|
87
|
+
id: 'intellicode',
|
|
88
|
+
url: `https://VisualStudioExptTeam.gallery.vsassets.io/_apis/public/gallery/publisher/VisualStudioExptTeam/extension/vscodeintellicode/${INTELLICODE_VERSION}/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage`,
|
|
89
|
+
alternateUrl: `https://marketplace.visualstudio.com/_apis/public/gallery/publishers/VisualStudioExptTeam/vsextensions/vscodeintellicode/${INTELLICODE_VERSION}/vspackage`,
|
|
90
|
+
archiveType: 'zip',
|
|
91
|
+
relativeExtractionPath: 'intellicode',
|
|
92
|
+
jarPath: 'extension/dist/com.microsoft.jdtls.intellicode.core-0.7.0.jar',
|
|
93
|
+
membersPath: 'extension/dist/bundledModels/java_intellisense-members'
|
|
94
|
+
};
|
|
95
|
+
export class EclipseJdtLanguageServer extends SolidLanguageServer {
|
|
96
|
+
handler;
|
|
97
|
+
runtimePaths;
|
|
98
|
+
initialized = false;
|
|
99
|
+
sentIntellicodeCommand = false;
|
|
100
|
+
constructor(config, loggerLike, repositoryRootPath, options = {}) {
|
|
101
|
+
const solidSettings = new SolidLspSettings(options?.solidlspSettings);
|
|
102
|
+
const runtimePaths = ensureRuntimeDependencies(solidSettings, loggerLike?.level);
|
|
103
|
+
const { command, env, workspaceDir } = createLaunchConfiguration(runtimePaths, solidSettings);
|
|
104
|
+
const handler = new NodeLanguageServerHandler({
|
|
105
|
+
cmd: command,
|
|
106
|
+
env,
|
|
107
|
+
cwd: repositoryRootPath
|
|
108
|
+
}, {
|
|
109
|
+
requestTimeoutSeconds: options?.timeout ?? null
|
|
110
|
+
});
|
|
111
|
+
super(config, loggerLike, repositoryRootPath, {
|
|
112
|
+
...options,
|
|
113
|
+
handler,
|
|
114
|
+
solidlspSettings: options?.solidlspSettings
|
|
115
|
+
});
|
|
116
|
+
this.handler = handler;
|
|
117
|
+
this.runtimePaths = runtimePaths;
|
|
118
|
+
this.registerHandlers(workspaceDir.sharedCacheDir);
|
|
119
|
+
}
|
|
120
|
+
start() {
|
|
121
|
+
const shouldInitialize = !this.initialized;
|
|
122
|
+
super.start();
|
|
123
|
+
if (shouldInitialize) {
|
|
124
|
+
this.initializeLanguageServer();
|
|
125
|
+
this.initialized = true;
|
|
126
|
+
}
|
|
127
|
+
return this;
|
|
128
|
+
}
|
|
129
|
+
stop(shutdownTimeout = 2.0) {
|
|
130
|
+
super.stop(shutdownTimeout);
|
|
131
|
+
this.initialized = false;
|
|
132
|
+
this.sentIntellicodeCommand = false;
|
|
133
|
+
}
|
|
134
|
+
registerHandlers(sharedCacheDir) {
|
|
135
|
+
this.handler.onRequest('client/registerCapability', (params) => {
|
|
136
|
+
this.handleRegisterCapability(params);
|
|
137
|
+
return [];
|
|
138
|
+
});
|
|
139
|
+
this.handler.onNotification('language/status', (params) => {
|
|
140
|
+
const payload = params;
|
|
141
|
+
if (payload?.type === 'ServiceReady' && payload.message === 'ServiceReady') {
|
|
142
|
+
this.logger.info('Eclipse JDT Language Server reported ServiceReady.');
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
this.handler.onNotification('window/logMessage', (payload) => {
|
|
146
|
+
const message = extractMessage(payload);
|
|
147
|
+
if (message) {
|
|
148
|
+
this.logger.info(`Eclipse JDT LS: ${message}`);
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
const noop = () => undefined;
|
|
152
|
+
this.handler.onNotification('$/progress', noop);
|
|
153
|
+
this.handler.onNotification('textDocument/publishDiagnostics', noop);
|
|
154
|
+
this.handler.onNotification('language/actionableNotification', noop);
|
|
155
|
+
this.handler.onRequest('workspace/executeClientCommand', (params) => {
|
|
156
|
+
if (params?.command === '_java.reloadBundles.command') {
|
|
157
|
+
return [];
|
|
158
|
+
}
|
|
159
|
+
return [];
|
|
160
|
+
});
|
|
161
|
+
// ensure shared cache directory exists
|
|
162
|
+
fs.mkdirSync(sharedCacheDir, { recursive: true });
|
|
163
|
+
}
|
|
164
|
+
initializeLanguageServer() {
|
|
165
|
+
const params = this.buildInitializeParams();
|
|
166
|
+
const response = this.handler.sendRequest('initialize', params);
|
|
167
|
+
if (!response || typeof response !== 'object') {
|
|
168
|
+
throw new Error('Eclipse JDT language server returned an invalid initialize response.');
|
|
169
|
+
}
|
|
170
|
+
this.verifyCapabilities(response.capabilities ?? null);
|
|
171
|
+
this.handler.notify.initialized({});
|
|
172
|
+
this.sendWorkspaceConfiguration(params);
|
|
173
|
+
}
|
|
174
|
+
sendWorkspaceConfiguration(params) {
|
|
175
|
+
const settings = params.initializationOptions?.settings;
|
|
176
|
+
if (!settings || typeof settings !== 'object') {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
const payload = { settings };
|
|
180
|
+
this.handler.sendNotification('workspace/didChangeConfiguration', payload);
|
|
181
|
+
}
|
|
182
|
+
buildInitializeParams() {
|
|
183
|
+
const rootUri = pathToFileUrl(this.repositoryRootPath);
|
|
184
|
+
const initializationOptions = buildInitializationOptions(this.runtimePaths);
|
|
185
|
+
const params = {
|
|
186
|
+
locale: 'en',
|
|
187
|
+
rootPath: this.repositoryRootPath,
|
|
188
|
+
rootUri,
|
|
189
|
+
capabilities: buildClientCapabilities(),
|
|
190
|
+
initializationOptions,
|
|
191
|
+
trace: 'verbose',
|
|
192
|
+
processId: process.pid,
|
|
193
|
+
workspaceFolders: [
|
|
194
|
+
{
|
|
195
|
+
uri: rootUri,
|
|
196
|
+
name: path.basename(this.repositoryRootPath)
|
|
197
|
+
}
|
|
198
|
+
]
|
|
199
|
+
};
|
|
200
|
+
return params;
|
|
201
|
+
}
|
|
202
|
+
verifyCapabilities(capabilities) {
|
|
203
|
+
if (!capabilities) {
|
|
204
|
+
throw new Error('Eclipse JDT initialization response is missing capabilities.');
|
|
205
|
+
}
|
|
206
|
+
const textDocumentSync = capabilities.textDocumentSync;
|
|
207
|
+
if (textDocumentSync?.change !== 2) {
|
|
208
|
+
throw new Error('Eclipse JDT language server must expose incremental textDocumentSync capability.');
|
|
209
|
+
}
|
|
210
|
+
if ('completionProvider' in capabilities || 'executeCommandProvider' in capabilities) {
|
|
211
|
+
throw new Error('Eclipse JDT language server returned unexpected completion/executeCommand provider capabilities.');
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
handleRegisterCapability(params) {
|
|
215
|
+
if (!params?.registrations) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
for (const registration of params.registrations) {
|
|
219
|
+
if (!registration) {
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
if (registration.method === 'textDocument/completion') {
|
|
223
|
+
this.logger.debug('Eclipse JDT LS registered completion provider.');
|
|
224
|
+
}
|
|
225
|
+
if (registration.method === 'workspace/executeCommand') {
|
|
226
|
+
const commands = registration.registerOptions?.commands ?? [];
|
|
227
|
+
if (!this.sentIntellicodeCommand && commands.includes('java.intellicode.enable')) {
|
|
228
|
+
this.sentIntellicodeCommand = true;
|
|
229
|
+
this.enableIntellicode();
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
enableIntellicode() {
|
|
235
|
+
const membersPath = this.runtimePaths.intellisenseMembersPath;
|
|
236
|
+
if (!fs.existsSync(membersPath)) {
|
|
237
|
+
this.logger.warn(`Intellicode members path not found at ${membersPath}; skipping enable command.`);
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
const result = this.handler.sendRequest('workspace/executeCommand', {
|
|
241
|
+
command: 'java.intellicode.enable',
|
|
242
|
+
arguments: [true, membersPath]
|
|
243
|
+
});
|
|
244
|
+
if (!result) {
|
|
245
|
+
throw new Error('Failed to enable Java Intellicode support.');
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
registerLanguageServer(Language.JAVA, EclipseJdtLanguageServer);
|
|
250
|
+
function ensureRuntimeDependencies(settings, loggerLevel) {
|
|
251
|
+
const runtimeRoot = path.join(settings.languageServersStaticDir, 'eclipse-jdtls');
|
|
252
|
+
fs.mkdirSync(runtimeRoot, { recursive: true });
|
|
253
|
+
const { logger } = createSerenaLogger({
|
|
254
|
+
name: 'solidlsp.language_servers.eclipse_jdtls',
|
|
255
|
+
emitToConsole: false,
|
|
256
|
+
level: loggerLevel === undefined ? undefined : coerceLogLevel(loggerLevel)
|
|
257
|
+
});
|
|
258
|
+
const gradlePath = ensureGradle(runtimeRoot, logger);
|
|
259
|
+
const vscodePaths = ensureVsCodeJava(runtimeRoot, logger);
|
|
260
|
+
const intellicodePaths = ensureIntellicode(runtimeRoot, logger);
|
|
261
|
+
return {
|
|
262
|
+
gradlePath,
|
|
263
|
+
jrePath: vscodePaths.jrePath,
|
|
264
|
+
jreHomePath: vscodePaths.jreHomePath,
|
|
265
|
+
lombokJarPath: vscodePaths.lombokJarPath,
|
|
266
|
+
jdtlsLauncherJarPath: vscodePaths.launcherJarPath,
|
|
267
|
+
jdtlsReadonlyConfigPath: vscodePaths.readonlyConfigPath,
|
|
268
|
+
intellicodeJarPath: intellicodePaths.jarPath,
|
|
269
|
+
intellisenseMembersPath: intellicodePaths.membersPath
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
function ensureGradle(runtimeRoot, logger) {
|
|
273
|
+
const expectedDir = path.join(runtimeRoot, `gradle-${GRADLE_VERSION}`);
|
|
274
|
+
if (fs.existsSync(expectedDir)) {
|
|
275
|
+
return expectedDir;
|
|
276
|
+
}
|
|
277
|
+
if (process.env.SERENA_SKIP_RUNTIME_INSTALL === '1') {
|
|
278
|
+
throw new Error(`gradle-${GRADLE_VERSION} not found at ${expectedDir}. Allow runtime downloads or install manually.`);
|
|
279
|
+
}
|
|
280
|
+
const collection = new RuntimeDependencyCollection([GRADLE_DEPENDENCY]);
|
|
281
|
+
logger.info(`Installing Gradle ${GRADLE_VERSION} runtime for Eclipse JDT LS.`);
|
|
282
|
+
collection.install(logger, runtimeRoot);
|
|
283
|
+
if (!fs.existsSync(expectedDir)) {
|
|
284
|
+
throw new Error(`Failed to install Gradle runtime. Expected directory at ${expectedDir}.`);
|
|
285
|
+
}
|
|
286
|
+
return expectedDir;
|
|
287
|
+
}
|
|
288
|
+
function ensureVsCodeJava(runtimeRoot, logger) {
|
|
289
|
+
const platform = determinePlatformId();
|
|
290
|
+
const dependency = VSCODE_JAVA_DEPENDENCIES[platform] ?? VSCODE_JAVA_DEPENDENCIES['darwin-arm64'];
|
|
291
|
+
if (!dependency) {
|
|
292
|
+
throw new Error(`Unsupported platform '${platform}' for Eclipse JDT LS runtime.`);
|
|
293
|
+
}
|
|
294
|
+
const targetDir = path.join(runtimeRoot, dependency.relativeExtractionPath);
|
|
295
|
+
const jreHomePath = path.join(targetDir, dependency.jreHomePath);
|
|
296
|
+
const jrePath = path.join(targetDir, dependency.jreBinaryPath);
|
|
297
|
+
const lombokJarPath = path.join(targetDir, dependency.lombokJarPath);
|
|
298
|
+
const launcherJarPath = path.join(targetDir, dependency.launcherJarPath);
|
|
299
|
+
const readonlyConfigPath = path.join(targetDir, dependency.readonlyConfigPath);
|
|
300
|
+
if (!pathsExist([jreHomePath, jrePath, lombokJarPath, launcherJarPath, readonlyConfigPath])) {
|
|
301
|
+
if (process.env.SERENA_SKIP_RUNTIME_INSTALL === '1') {
|
|
302
|
+
throw new Error(`VS Code Java runtime not found at ${targetDir}. Allow downloads or pre-install the extension contents manually.`);
|
|
303
|
+
}
|
|
304
|
+
const collection = new RuntimeDependencyCollection([dependency]);
|
|
305
|
+
logger.info(`Installing VS Code Java extension runtime for platform ${platform}.`);
|
|
306
|
+
collection.install(logger, targetDir);
|
|
307
|
+
}
|
|
308
|
+
if (!pathsExist([jreHomePath, jrePath, lombokJarPath, launcherJarPath, readonlyConfigPath])) {
|
|
309
|
+
throw new Error(`VS Code Java runtime incomplete. Expected assets under ${targetDir}.`);
|
|
310
|
+
}
|
|
311
|
+
if (process.platform !== 'win32') {
|
|
312
|
+
try {
|
|
313
|
+
fs.chmodSync(jrePath, 0o755);
|
|
314
|
+
}
|
|
315
|
+
catch {
|
|
316
|
+
// best effort
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
return {
|
|
320
|
+
jrePath,
|
|
321
|
+
jreHomePath,
|
|
322
|
+
lombokJarPath,
|
|
323
|
+
launcherJarPath,
|
|
324
|
+
readonlyConfigPath
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
function ensureIntellicode(runtimeRoot, logger) {
|
|
328
|
+
const targetDir = path.join(runtimeRoot, INTELLICODE_DEPENDENCY.relativeExtractionPath);
|
|
329
|
+
const jarPath = path.join(targetDir, INTELLICODE_DEPENDENCY.jarPath);
|
|
330
|
+
const membersPath = path.join(targetDir, INTELLICODE_DEPENDENCY.membersPath);
|
|
331
|
+
if (!pathsExist([jarPath, membersPath])) {
|
|
332
|
+
if (process.env.SERENA_SKIP_RUNTIME_INSTALL === '1') {
|
|
333
|
+
throw new Error(`Intellicode runtime assets not found at ${targetDir}. Allow downloads or pre-install the VSIX contents manually.`);
|
|
334
|
+
}
|
|
335
|
+
const download = (url) => {
|
|
336
|
+
const collection = new RuntimeDependencyCollection([{ ...INTELLICODE_DEPENDENCY, url }]);
|
|
337
|
+
collection.install(logger, targetDir);
|
|
338
|
+
};
|
|
339
|
+
try {
|
|
340
|
+
logger.info('Installing IntelliCode support for Eclipse JDT LS.');
|
|
341
|
+
download(INTELLICODE_DEPENDENCY.url ?? '');
|
|
342
|
+
}
|
|
343
|
+
catch (error) {
|
|
344
|
+
if (INTELLICODE_DEPENDENCY.alternateUrl) {
|
|
345
|
+
logger.warn('Primary IntelliCode download failed, retrying alternate URL.');
|
|
346
|
+
download(INTELLICODE_DEPENDENCY.alternateUrl);
|
|
347
|
+
}
|
|
348
|
+
else {
|
|
349
|
+
throw error;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
if (!pathsExist([jarPath, membersPath])) {
|
|
354
|
+
throw new Error(`Failed to install IntelliCode assets. Expected jar and members under ${targetDir}.`);
|
|
355
|
+
}
|
|
356
|
+
return { jarPath, membersPath };
|
|
357
|
+
}
|
|
358
|
+
function createLaunchConfiguration(runtimePaths, settings) {
|
|
359
|
+
const workspaceRoot = path.join(settings.languageServersStaticDir, 'EclipseJDTLS', 'workspaces');
|
|
360
|
+
fs.mkdirSync(workspaceRoot, { recursive: true });
|
|
361
|
+
const workspaceId = crypto.randomUUID();
|
|
362
|
+
const wsDir = path.join(workspaceRoot, workspaceId);
|
|
363
|
+
const dataDir = path.join(wsDir, 'data_dir');
|
|
364
|
+
const configDir = path.join(wsDir, 'config_path');
|
|
365
|
+
const sharedCacheDir = path.join(settings.languageServersStaticDir, 'lsp', 'EclipseJDTLS', 'sharedIndex');
|
|
366
|
+
fs.mkdirSync(dataDir, { recursive: true });
|
|
367
|
+
fs.mkdirSync(sharedCacheDir, { recursive: true });
|
|
368
|
+
if (!fs.existsSync(configDir)) {
|
|
369
|
+
copyDirectory(runtimePaths.jdtlsReadonlyConfigPath, configDir);
|
|
370
|
+
}
|
|
371
|
+
const command = [
|
|
372
|
+
runtimePaths.jrePath,
|
|
373
|
+
'--add-modules=ALL-SYSTEM',
|
|
374
|
+
'--add-opens',
|
|
375
|
+
'java.base/java.util=ALL-UNNAMED',
|
|
376
|
+
'--add-opens',
|
|
377
|
+
'java.base/java.lang=ALL-UNNAMED',
|
|
378
|
+
'--add-opens',
|
|
379
|
+
'java.base/sun.nio.fs=ALL-UNNAMED',
|
|
380
|
+
'-Declipse.application=org.eclipse.jdt.ls.core.id1',
|
|
381
|
+
'-Dosgi.bundles.defaultStartLevel=4',
|
|
382
|
+
'-Declipse.product=org.eclipse.jdt.ls.core.product',
|
|
383
|
+
'-Djava.import.generatesMetadataFilesAtProjectRoot=false',
|
|
384
|
+
'-Dfile.encoding=utf8',
|
|
385
|
+
'-noverify',
|
|
386
|
+
'-XX:+UseParallelGC',
|
|
387
|
+
'-XX:GCTimeRatio=4',
|
|
388
|
+
'-XX:AdaptiveSizePolicyWeight=90',
|
|
389
|
+
'-Dsun.zip.disableMemoryMapping=true',
|
|
390
|
+
'-Djava.lsp.joinOnCompletion=true',
|
|
391
|
+
'-Xmx3G',
|
|
392
|
+
'-Xms100m',
|
|
393
|
+
'-Xlog:disable',
|
|
394
|
+
'-Dlog.level=ALL',
|
|
395
|
+
`-javaagent:${runtimePaths.lombokJarPath}`,
|
|
396
|
+
`-Djdt.core.sharedIndexLocation=${sharedCacheDir}`,
|
|
397
|
+
'-jar',
|
|
398
|
+
runtimePaths.jdtlsLauncherJarPath,
|
|
399
|
+
'-configuration',
|
|
400
|
+
configDir,
|
|
401
|
+
'-data',
|
|
402
|
+
dataDir
|
|
403
|
+
];
|
|
404
|
+
const env = {
|
|
405
|
+
syntaxserver: 'false',
|
|
406
|
+
JAVA_HOME: runtimePaths.jreHomePath
|
|
407
|
+
};
|
|
408
|
+
return {
|
|
409
|
+
command,
|
|
410
|
+
env,
|
|
411
|
+
workspaceDir: { root: wsDir, configDir, sharedCacheDir }
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
function buildInitializationOptions(runtimePaths) {
|
|
415
|
+
const initializationOptions = {
|
|
416
|
+
bundles: ['intellicode-core.jar'],
|
|
417
|
+
settings: {
|
|
418
|
+
java: {
|
|
419
|
+
home: null,
|
|
420
|
+
jdt: {
|
|
421
|
+
ls: {
|
|
422
|
+
java: {
|
|
423
|
+
home: runtimePaths.jreHomePath
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
},
|
|
427
|
+
configuration: {
|
|
428
|
+
runtimes: [
|
|
429
|
+
{
|
|
430
|
+
name: 'JavaSE-21',
|
|
431
|
+
path: runtimePaths.jreHomePath,
|
|
432
|
+
default: true
|
|
433
|
+
}
|
|
434
|
+
]
|
|
435
|
+
},
|
|
436
|
+
import: {
|
|
437
|
+
gradle: {
|
|
438
|
+
enabled: true,
|
|
439
|
+
wrapper: {
|
|
440
|
+
enabled: true
|
|
441
|
+
},
|
|
442
|
+
user: {
|
|
443
|
+
home: runtimePaths.gradlePath
|
|
444
|
+
},
|
|
445
|
+
java: {
|
|
446
|
+
home: runtimePaths.jrePath
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
},
|
|
452
|
+
workspaceFolders: []
|
|
453
|
+
};
|
|
454
|
+
return initializationOptions;
|
|
455
|
+
}
|
|
456
|
+
function buildClientCapabilities() {
|
|
457
|
+
const symbolKinds = rangeArray(1, 27);
|
|
458
|
+
const tokenTypes = [
|
|
459
|
+
'namespace',
|
|
460
|
+
'type',
|
|
461
|
+
'class',
|
|
462
|
+
'enum',
|
|
463
|
+
'interface',
|
|
464
|
+
'struct',
|
|
465
|
+
'typeParameter',
|
|
466
|
+
'parameter',
|
|
467
|
+
'variable',
|
|
468
|
+
'property',
|
|
469
|
+
'enumMember',
|
|
470
|
+
'event',
|
|
471
|
+
'function',
|
|
472
|
+
'method',
|
|
473
|
+
'macro',
|
|
474
|
+
'keyword',
|
|
475
|
+
'modifier',
|
|
476
|
+
'comment',
|
|
477
|
+
'string',
|
|
478
|
+
'number',
|
|
479
|
+
'regexp',
|
|
480
|
+
'operator',
|
|
481
|
+
'decorator'
|
|
482
|
+
];
|
|
483
|
+
const tokenModifiers = [
|
|
484
|
+
'declaration',
|
|
485
|
+
'definition',
|
|
486
|
+
'readonly',
|
|
487
|
+
'static',
|
|
488
|
+
'deprecated',
|
|
489
|
+
'abstract',
|
|
490
|
+
'async',
|
|
491
|
+
'modification',
|
|
492
|
+
'documentation',
|
|
493
|
+
'defaultLibrary'
|
|
494
|
+
];
|
|
495
|
+
return {
|
|
496
|
+
workspace: {
|
|
497
|
+
applyEdit: true,
|
|
498
|
+
workspaceEdit: {
|
|
499
|
+
documentChanges: true,
|
|
500
|
+
resourceOperations: ['create', 'rename', 'delete'],
|
|
501
|
+
failureHandling: 'textOnlyTransactional',
|
|
502
|
+
normalizesLineEndings: true,
|
|
503
|
+
changeAnnotationSupport: { groupsOnLabel: true }
|
|
504
|
+
},
|
|
505
|
+
didChangeConfiguration: { dynamicRegistration: true },
|
|
506
|
+
didChangeWatchedFiles: { dynamicRegistration: true, relativePatternSupport: true },
|
|
507
|
+
symbol: {
|
|
508
|
+
dynamicRegistration: true,
|
|
509
|
+
symbolKind: { valueSet: symbolKinds },
|
|
510
|
+
tagSupport: { valueSet: [1] },
|
|
511
|
+
resolveSupport: { properties: ['location.range'] }
|
|
512
|
+
},
|
|
513
|
+
codeLens: { refreshSupport: true },
|
|
514
|
+
executeCommand: { dynamicRegistration: true },
|
|
515
|
+
configuration: true,
|
|
516
|
+
workspaceFolders: true,
|
|
517
|
+
semanticTokens: { refreshSupport: true },
|
|
518
|
+
fileOperations: {
|
|
519
|
+
dynamicRegistration: true,
|
|
520
|
+
didCreate: true,
|
|
521
|
+
didRename: true,
|
|
522
|
+
didDelete: true,
|
|
523
|
+
willCreate: true,
|
|
524
|
+
willRename: true,
|
|
525
|
+
willDelete: true
|
|
526
|
+
},
|
|
527
|
+
inlineValue: { refreshSupport: true },
|
|
528
|
+
inlayHint: { refreshSupport: true },
|
|
529
|
+
diagnostics: { refreshSupport: true }
|
|
530
|
+
},
|
|
531
|
+
textDocument: {
|
|
532
|
+
publishDiagnostics: {
|
|
533
|
+
relatedInformation: true,
|
|
534
|
+
versionSupport: false,
|
|
535
|
+
tagSupport: { valueSet: [1, 2] },
|
|
536
|
+
codeDescriptionSupport: true,
|
|
537
|
+
dataSupport: true
|
|
538
|
+
},
|
|
539
|
+
synchronization: {
|
|
540
|
+
dynamicRegistration: true,
|
|
541
|
+
willSave: true,
|
|
542
|
+
willSaveWaitUntil: true,
|
|
543
|
+
didSave: true
|
|
544
|
+
},
|
|
545
|
+
completion: {
|
|
546
|
+
dynamicRegistration: true,
|
|
547
|
+
contextSupport: true,
|
|
548
|
+
completionItem: {
|
|
549
|
+
snippetSupport: false,
|
|
550
|
+
commitCharactersSupport: true,
|
|
551
|
+
documentationFormat: ['markdown', 'plaintext'],
|
|
552
|
+
deprecatedSupport: true,
|
|
553
|
+
preselectSupport: true,
|
|
554
|
+
tagSupport: { valueSet: [1] },
|
|
555
|
+
insertReplaceSupport: false,
|
|
556
|
+
resolveSupport: { properties: ['documentation', 'detail', 'additionalTextEdits'] },
|
|
557
|
+
insertTextModeSupport: { valueSet: [1, 2] },
|
|
558
|
+
labelDetailsSupport: true
|
|
559
|
+
},
|
|
560
|
+
insertTextMode: 2,
|
|
561
|
+
completionItemKind: { valueSet: rangeArray(1, 26) },
|
|
562
|
+
completionList: { itemDefaults: ['commitCharacters', 'editRange', 'insertTextFormat', 'insertTextMode'] }
|
|
563
|
+
},
|
|
564
|
+
hover: { dynamicRegistration: true, contentFormat: ['markdown', 'plaintext'] },
|
|
565
|
+
signatureHelp: {
|
|
566
|
+
dynamicRegistration: true,
|
|
567
|
+
signatureInformation: {
|
|
568
|
+
documentationFormat: ['markdown', 'plaintext'],
|
|
569
|
+
parameterInformation: { labelOffsetSupport: true },
|
|
570
|
+
activeParameterSupport: true
|
|
571
|
+
}
|
|
572
|
+
},
|
|
573
|
+
definition: { dynamicRegistration: true, linkSupport: true },
|
|
574
|
+
references: { dynamicRegistration: true },
|
|
575
|
+
documentSymbol: {
|
|
576
|
+
dynamicRegistration: true,
|
|
577
|
+
symbolKind: { valueSet: symbolKinds },
|
|
578
|
+
hierarchicalDocumentSymbolSupport: true,
|
|
579
|
+
tagSupport: { valueSet: [1] },
|
|
580
|
+
labelSupport: true
|
|
581
|
+
},
|
|
582
|
+
rename: {
|
|
583
|
+
dynamicRegistration: true,
|
|
584
|
+
prepareSupport: true,
|
|
585
|
+
prepareSupportDefaultBehavior: 1,
|
|
586
|
+
honorsChangeAnnotations: true
|
|
587
|
+
},
|
|
588
|
+
documentLink: { dynamicRegistration: true, tooltipSupport: true },
|
|
589
|
+
typeDefinition: { dynamicRegistration: true, linkSupport: true },
|
|
590
|
+
implementation: { dynamicRegistration: true, linkSupport: true },
|
|
591
|
+
colorProvider: { dynamicRegistration: true },
|
|
592
|
+
declaration: { dynamicRegistration: true, linkSupport: true },
|
|
593
|
+
selectionRange: { dynamicRegistration: true },
|
|
594
|
+
callHierarchy: { dynamicRegistration: true },
|
|
595
|
+
semanticTokens: {
|
|
596
|
+
dynamicRegistration: true,
|
|
597
|
+
tokenTypes,
|
|
598
|
+
tokenModifiers,
|
|
599
|
+
formats: ['relative'],
|
|
600
|
+
requests: { range: true, full: { delta: true } },
|
|
601
|
+
multilineTokenSupport: false,
|
|
602
|
+
overlappingTokenSupport: false,
|
|
603
|
+
serverCancelSupport: true,
|
|
604
|
+
augmentsSyntaxTokens: true
|
|
605
|
+
},
|
|
606
|
+
typeHierarchy: { dynamicRegistration: true },
|
|
607
|
+
inlineValue: { dynamicRegistration: true },
|
|
608
|
+
diagnostic: { dynamicRegistration: true, relatedDocumentSupport: false }
|
|
609
|
+
},
|
|
610
|
+
general: {
|
|
611
|
+
staleRequestSupport: {
|
|
612
|
+
cancel: true,
|
|
613
|
+
retryOnContentModified: [
|
|
614
|
+
'textDocument/semanticTokens/full',
|
|
615
|
+
'textDocument/semanticTokens/range',
|
|
616
|
+
'textDocument/semanticTokens/full/delta'
|
|
617
|
+
]
|
|
618
|
+
},
|
|
619
|
+
regularExpressions: { engine: 'ECMAScript', version: 'ES2020' },
|
|
620
|
+
positionEncodings: ['utf-16']
|
|
621
|
+
},
|
|
622
|
+
notebookDocument: {
|
|
623
|
+
synchronization: { dynamicRegistration: true, executionSummarySupport: true }
|
|
624
|
+
}
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
function rangeArray(start, endExclusive) {
|
|
628
|
+
const result = [];
|
|
629
|
+
for (let i = start; i < endExclusive; i += 1) {
|
|
630
|
+
result.push(i);
|
|
631
|
+
}
|
|
632
|
+
return result;
|
|
633
|
+
}
|
|
634
|
+
function determinePlatformId() {
|
|
635
|
+
const platform = process.platform;
|
|
636
|
+
const arch = process.arch;
|
|
637
|
+
if (platform === 'win32') {
|
|
638
|
+
return 'win-x64';
|
|
639
|
+
}
|
|
640
|
+
if (platform === 'darwin') {
|
|
641
|
+
return arch === 'arm64' ? 'osx-arm64' : 'osx-x64';
|
|
642
|
+
}
|
|
643
|
+
if (platform === 'linux') {
|
|
644
|
+
return arch === 'arm64' ? 'linux-arm64' : 'linux-x64';
|
|
645
|
+
}
|
|
646
|
+
// fallback for legacy naming used in the Python implementation
|
|
647
|
+
return 'darwin-arm64';
|
|
648
|
+
}
|
|
649
|
+
function pathsExist(paths) {
|
|
650
|
+
return paths.every((candidate) => fs.existsSync(candidate));
|
|
651
|
+
}
|
|
652
|
+
function copyDirectory(source, destination) {
|
|
653
|
+
if (!fs.existsSync(source)) {
|
|
654
|
+
throw new Error(`Cannot copy directory – source path '${source}' does not exist.`);
|
|
655
|
+
}
|
|
656
|
+
fs.mkdirSync(path.dirname(destination), { recursive: true });
|
|
657
|
+
if (fs.existsSync(destination)) {
|
|
658
|
+
return;
|
|
659
|
+
}
|
|
660
|
+
fs.cpSync(source, destination, { recursive: true });
|
|
661
|
+
}
|
|
662
|
+
function extractMessage(payload) {
|
|
663
|
+
if (!payload || typeof payload !== 'object') {
|
|
664
|
+
return null;
|
|
665
|
+
}
|
|
666
|
+
const message = payload.message;
|
|
667
|
+
return typeof message === 'string' ? message : null;
|
|
668
|
+
}
|
|
669
|
+
function pathToFileUrl(candidate) {
|
|
670
|
+
return pathToFileURL(candidate).href;
|
|
671
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SolidLanguageServer, type LanguageServerConfigLike, type SolidLanguageServerOptions } from '../ls.js';
|
|
2
|
+
import { NodeLanguageServerHandler } from '../ls_handler.js';
|
|
3
|
+
export declare class ErlangLanguageServer extends SolidLanguageServer {
|
|
4
|
+
protected readonly handler: NodeLanguageServerHandler;
|
|
5
|
+
private initialized;
|
|
6
|
+
private readyPromise;
|
|
7
|
+
private readyResolver;
|
|
8
|
+
constructor(config: LanguageServerConfigLike, loggerLike: {
|
|
9
|
+
level?: number;
|
|
10
|
+
} | null, repositoryRootPath: string, options?: SolidLanguageServerOptions);
|
|
11
|
+
start(): this;
|
|
12
|
+
stop(shutdownTimeout?: number): void;
|
|
13
|
+
private initializeLanguageServer;
|
|
14
|
+
private buildInitializeParams;
|
|
15
|
+
private verifyCapabilities;
|
|
16
|
+
private registerHandlers;
|
|
17
|
+
private handleWindowLogMessage;
|
|
18
|
+
private handleProgressNotification;
|
|
19
|
+
private waitForReadiness;
|
|
20
|
+
private markServerReady;
|
|
21
|
+
private createReadyPromise;
|
|
22
|
+
}
|