@nogataka/smart-edit 0.1.0 → 0.3.0
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 +0 -1
- package/README.md +143 -66
- package/dist/cli.js +2 -2
- package/dist/devtools/generate_prompt_factory.js +5 -5
- package/dist/index.d.ts +33 -34
- package/dist/index.js +33 -34
- package/dist/interprompt/multilang_prompt.js +2 -2
- package/dist/interprompt/prompt_factory.js +2 -2
- package/dist/interprompt/util/class_decorators.d.ts +1 -1
- package/dist/interprompt/util/class_decorators.js +1 -1
- package/dist/{serena → smart-edit}/agent.d.ts +20 -20
- package/dist/{serena → smart-edit}/agent.js +43 -43
- package/dist/{serena → smart-edit}/analytics.d.ts +1 -1
- package/dist/{serena → smart-edit}/analytics.js +3 -3
- package/dist/smart-edit/cli.d.ts +9 -0
- package/dist/{serena → smart-edit}/cli.js +49 -99
- package/dist/{serena → smart-edit}/code_editor.d.ts +7 -7
- package/dist/{serena → smart-edit}/config/context_mode.d.ts +13 -13
- package/dist/{serena → smart-edit}/config/context_mode.js +12 -12
- package/dist/{serena/config/serena_config.d.ts → smart-edit/config/smart_edit_config.d.ts} +14 -14
- package/dist/{serena/config/serena_config.js → smart-edit/config/smart_edit_config.js} +31 -31
- package/dist/smart-edit/constants.d.ts +18 -0
- package/dist/smart-edit/constants.js +27 -0
- package/dist/{serena → smart-edit}/dashboard.d.ts +3 -3
- package/dist/{serena → smart-edit}/dashboard.js +10 -10
- package/dist/{serena → smart-edit}/gui_log_viewer.js +6 -6
- package/dist/{serena → smart-edit}/mcp.d.ts +40 -40
- package/dist/{serena → smart-edit}/mcp.js +38 -38
- package/dist/{serena → smart-edit}/project.d.ts +7 -7
- package/dist/{serena → smart-edit}/project.js +18 -18
- package/dist/{serena → smart-edit}/prompt_factory.d.ts +3 -3
- package/dist/{serena → smart-edit}/prompt_factory.js +1 -1
- package/dist/{serena → smart-edit}/resources/config/contexts/codex.yml +2 -2
- package/dist/{serena → smart-edit}/resources/config/contexts/context.template.yml +1 -1
- package/dist/{serena → smart-edit}/resources/config/contexts/ide-assistant.yml +2 -2
- package/dist/{serena → smart-edit}/resources/config/modes/mode.template.yml +1 -1
- package/dist/{serena → smart-edit}/resources/config/prompt_templates/simple_tool_outputs.yml +1 -1
- package/dist/smart-edit/resources/dashboard/dashboard.js +13 -0
- package/dist/smart-edit/resources/dashboard/index.css +1 -0
- package/dist/smart-edit/resources/dashboard/index.html +13 -0
- package/dist/{serena → smart-edit}/resources/project.template.yml +6 -6
- package/dist/{serena/resources/serena_config.template.yml → smart-edit/resources/smart_edit_config.template.yml} +14 -14
- package/dist/{serena → smart-edit}/symbol.d.ts +7 -7
- package/dist/{serena → smart-edit}/symbol.js +2 -2
- package/dist/{serena → smart-edit}/text_utils.js +2 -2
- package/dist/{serena → smart-edit}/tools/config_tools.d.ts +1 -1
- package/dist/{serena → smart-edit}/tools/config_tools.js +6 -6
- package/dist/{serena → smart-edit}/tools/memory_tools.d.ts +4 -4
- package/dist/{serena → smart-edit}/tools/memory_tools.js +5 -5
- package/dist/{serena → smart-edit}/tools/tools_base.d.ts +15 -15
- package/dist/{serena → smart-edit}/tools/tools_base.js +7 -7
- package/dist/{serena → smart-edit}/util/exception.d.ts +2 -2
- package/dist/{serena → smart-edit}/util/exception.js +2 -2
- package/dist/{serena → smart-edit}/util/file_system.js +3 -3
- package/dist/{serena → smart-edit}/util/git.js +3 -3
- package/dist/{serena → smart-edit}/util/inspection.d.ts +3 -3
- package/dist/{serena → smart-edit}/util/inspection.js +3 -3
- package/dist/{serena → smart-edit}/util/logging.d.ts +6 -6
- package/dist/{serena → smart-edit}/util/logging.js +7 -7
- package/dist/{serena → smart-edit}/util/shell.js +1 -1
- package/dist/smart-edit/version.d.ts +1 -0
- package/dist/{serena → smart-edit}/version.js +3 -3
- package/dist/{solidlsp → smart-lsp}/language_servers/autoload.js +1 -1
- package/dist/smart-lsp/language_servers/bash_language_server.d.ts +10 -0
- package/dist/{solidlsp → smart-lsp}/language_servers/bash_language_server.js +8 -8
- package/dist/{solidlsp → smart-lsp}/language_servers/clangd_language_server.d.ts +4 -4
- package/dist/{solidlsp → smart-lsp}/language_servers/clangd_language_server.js +9 -9
- package/dist/{solidlsp → smart-lsp}/language_servers/clojure_lsp.d.ts +4 -4
- package/dist/{solidlsp → smart-lsp}/language_servers/clojure_lsp.js +9 -9
- package/dist/{solidlsp → smart-lsp}/language_servers/common.d.ts +2 -2
- package/dist/{solidlsp → smart-lsp}/language_servers/common.js +1 -1
- package/dist/{solidlsp → smart-lsp}/language_servers/csharp_language_server.d.ts +4 -4
- package/dist/{solidlsp → smart-lsp}/language_servers/csharp_language_server.js +12 -12
- package/dist/smart-lsp/language_servers/dart_language_server.d.ts +10 -0
- package/dist/{solidlsp → smart-lsp}/language_servers/dart_language_server.js +13 -13
- package/dist/{solidlsp → smart-lsp}/language_servers/eclipse_jdtls.d.ts +4 -4
- package/dist/{solidlsp → smart-lsp}/language_servers/eclipse_jdtls.js +12 -12
- package/dist/{solidlsp → smart-lsp}/language_servers/erlang_language_server.d.ts +3 -3
- package/dist/{solidlsp → smart-lsp}/language_servers/erlang_language_server.js +6 -6
- package/dist/{solidlsp → smart-lsp}/language_servers/gopls.d.ts +3 -3
- package/dist/{solidlsp → smart-lsp}/language_servers/gopls.js +4 -4
- package/dist/{solidlsp → smart-lsp}/language_servers/intelephense.d.ts +4 -4
- package/dist/{solidlsp → smart-lsp}/language_servers/intelephense.js +11 -11
- package/dist/{solidlsp → smart-lsp}/language_servers/jedi_server.d.ts +4 -4
- package/dist/{solidlsp → smart-lsp}/language_servers/jedi_server.js +4 -4
- package/dist/{solidlsp → smart-lsp}/language_servers/kotlin_language_server.d.ts +4 -4
- package/dist/{solidlsp → smart-lsp}/language_servers/kotlin_language_server.js +9 -9
- package/dist/{solidlsp → smart-lsp}/language_servers/lua_ls.d.ts +4 -4
- package/dist/{solidlsp → smart-lsp}/language_servers/lua_ls.js +10 -10
- package/dist/{solidlsp → smart-lsp}/language_servers/nixd_language_server.d.ts +4 -4
- package/dist/{solidlsp → smart-lsp}/language_servers/nixd_language_server.js +7 -7
- package/dist/{solidlsp → smart-lsp}/language_servers/pyright_server.d.ts +4 -4
- package/dist/{solidlsp → smart-lsp}/language_servers/pyright_server.js +3 -3
- package/dist/{solidlsp → smart-lsp}/language_servers/r_language_server.d.ts +4 -4
- package/dist/{solidlsp → smart-lsp}/language_servers/r_language_server.js +5 -5
- package/dist/smart-lsp/language_servers/ruby_common.d.ts +10 -0
- package/dist/{solidlsp → smart-lsp}/language_servers/ruby_common.js +4 -4
- package/dist/{solidlsp → smart-lsp}/language_servers/ruby_lsp.d.ts +4 -4
- package/dist/{solidlsp → smart-lsp}/language_servers/ruby_lsp.js +10 -10
- package/dist/{solidlsp → smart-lsp}/language_servers/rust_analyzer.d.ts +4 -4
- package/dist/{solidlsp → smart-lsp}/language_servers/rust_analyzer.js +4 -4
- package/dist/{solidlsp → smart-lsp}/language_servers/solargraph.d.ts +4 -4
- package/dist/{solidlsp → smart-lsp}/language_servers/solargraph.js +10 -10
- package/dist/{solidlsp → smart-lsp}/language_servers/sourcekit_lsp.d.ts +4 -4
- package/dist/{solidlsp → smart-lsp}/language_servers/sourcekit_lsp.js +7 -7
- package/dist/{solidlsp → smart-lsp}/language_servers/terraform_ls.d.ts +4 -4
- package/dist/{solidlsp → smart-lsp}/language_servers/terraform_ls.js +14 -14
- package/dist/{solidlsp → smart-lsp}/language_servers/typescript_language_server.d.ts +4 -4
- package/dist/{solidlsp → smart-lsp}/language_servers/typescript_language_server.js +11 -11
- package/dist/{solidlsp → smart-lsp}/language_servers/vts_language_server.d.ts +4 -4
- package/dist/{solidlsp → smart-lsp}/language_servers/vts_language_server.js +10 -10
- package/dist/{solidlsp → smart-lsp}/language_servers/zls.d.ts +4 -4
- package/dist/{solidlsp → smart-lsp}/language_servers/zls.js +6 -6
- package/dist/{solidlsp → smart-lsp}/ls.d.ts +25 -25
- package/dist/{solidlsp → smart-lsp}/ls.js +19 -19
- package/dist/{solidlsp → smart-lsp}/ls_config.d.ts +0 -5
- package/dist/{solidlsp → smart-lsp}/ls_config.js +0 -5
- package/dist/{solidlsp → smart-lsp}/ls_exceptions.d.ts +1 -1
- package/dist/{solidlsp → smart-lsp}/ls_exceptions.js +2 -2
- package/dist/{solidlsp → smart-lsp}/ls_handler.d.ts +7 -7
- package/dist/{solidlsp → smart-lsp}/ls_handler.js +12 -12
- package/dist/{solidlsp → smart-lsp}/ls_request.d.ts +4 -4
- package/dist/{solidlsp → smart-lsp}/ls_request.js +3 -3
- package/package.json +13 -3
- package/dist/serena/agno.d.ts +0 -111
- package/dist/serena/agno.js +0 -278
- package/dist/serena/cli.d.ts +0 -9
- package/dist/serena/constants.d.ts +0 -18
- package/dist/serena/constants.js +0 -27
- package/dist/serena/resources/dashboard/dashboard.js +0 -816
- package/dist/serena/resources/dashboard/index.html +0 -312
- package/dist/serena/resources/dashboard/jquery.min.js +0 -3
- package/dist/serena/version.d.ts +0 -1
- package/dist/solidlsp/language_servers/bash_language_server.d.ts +0 -10
- package/dist/solidlsp/language_servers/dart_language_server.d.ts +0 -10
- package/dist/solidlsp/language_servers/ruby_common.d.ts +0 -10
- /package/dist/{serena → smart-edit}/code_editor.js +0 -0
- /package/dist/{serena → smart-edit}/generated/generated_prompt_factory.d.ts +0 -0
- /package/dist/{serena → smart-edit}/generated/generated_prompt_factory.js +0 -0
- /package/dist/{serena → smart-edit}/gui_log_viewer.d.ts +0 -0
- /package/dist/{serena → smart-edit}/resources/config/contexts/agent.yml +0 -0
- /package/dist/{serena → smart-edit}/resources/config/contexts/chatgpt.yml +0 -0
- /package/dist/{serena → smart-edit}/resources/config/contexts/desktop-app.yml +0 -0
- /package/dist/{serena → smart-edit}/resources/config/contexts/oaicompat-agent.yml +0 -0
- /package/dist/{serena → smart-edit}/resources/config/internal_modes/jetbrains.yml +0 -0
- /package/dist/{serena → smart-edit}/resources/config/modes/editing.yml +0 -0
- /package/dist/{serena → smart-edit}/resources/config/modes/interactive.yml +0 -0
- /package/dist/{serena → smart-edit}/resources/config/modes/no-onboarding.yml +0 -0
- /package/dist/{serena → smart-edit}/resources/config/modes/onboarding.yml +0 -0
- /package/dist/{serena → smart-edit}/resources/config/modes/one-shot.yml +0 -0
- /package/dist/{serena → smart-edit}/resources/config/modes/planning.yml +0 -0
- /package/dist/{serena → smart-edit}/resources/config/prompt_templates/system_prompt.yml +0 -0
- /package/dist/{serena/resources/dashboard/serena-icon-16.svg → smart-edit/resources/dashboard/smart-edit-icon-16.svg} +0 -0
- /package/dist/{serena/resources/dashboard/serena-icon-32.svg → smart-edit/resources/dashboard/smart-edit-icon-32.svg} +0 -0
- /package/dist/{serena/resources/dashboard/serena-icon-48.svg → smart-edit/resources/dashboard/smart-edit-icon-48.svg} +0 -0
- /package/dist/{serena/resources/dashboard/serena-logs-dark-mode.svg → smart-edit/resources/dashboard/smart-edit-logs-dark-mode.svg} +0 -0
- /package/dist/{serena/resources/dashboard/serena-logs.svg → smart-edit/resources/dashboard/smart-edit-logs.svg} +0 -0
- /package/dist/{serena → smart-edit}/text_utils.d.ts +0 -0
- /package/dist/{serena → smart-edit}/tools/cmd_tools.d.ts +0 -0
- /package/dist/{serena → smart-edit}/tools/cmd_tools.js +0 -0
- /package/dist/{serena → smart-edit}/tools/file_tools.d.ts +0 -0
- /package/dist/{serena → smart-edit}/tools/file_tools.js +0 -0
- /package/dist/{serena → smart-edit}/tools/index.d.ts +0 -0
- /package/dist/{serena → smart-edit}/tools/index.js +0 -0
- /package/dist/{serena → smart-edit}/tools/symbol_tools.d.ts +0 -0
- /package/dist/{serena → smart-edit}/tools/symbol_tools.js +0 -0
- /package/dist/{serena → smart-edit}/tools/workflow_tools.d.ts +0 -0
- /package/dist/{serena → smart-edit}/tools/workflow_tools.js +0 -0
- /package/dist/{serena → smart-edit}/util/class_decorators.d.ts +0 -0
- /package/dist/{serena → smart-edit}/util/class_decorators.js +0 -0
- /package/dist/{serena → smart-edit}/util/file_system.d.ts +0 -0
- /package/dist/{serena → smart-edit}/util/general.d.ts +0 -0
- /package/dist/{serena → smart-edit}/util/general.js +0 -0
- /package/dist/{serena → smart-edit}/util/git.d.ts +0 -0
- /package/dist/{serena → smart-edit}/util/shell.d.ts +0 -0
- /package/dist/{serena → smart-edit}/util/thread.d.ts +0 -0
- /package/dist/{serena → smart-edit}/util/thread.js +0 -0
- /package/dist/{solidlsp → smart-lsp}/language_servers/autoload.d.ts +0 -0
- /package/dist/{solidlsp → smart-lsp}/ls_types.d.ts +0 -0
- /package/dist/{solidlsp → smart-lsp}/ls_types.js +0 -0
- /package/dist/{solidlsp → smart-lsp}/lsp_protocol_handler/server.d.ts +0 -0
- /package/dist/{solidlsp → smart-lsp}/lsp_protocol_handler/server.js +0 -0
- /package/dist/{solidlsp → smart-lsp}/util/subprocess_util.d.ts +0 -0
- /package/dist/{solidlsp → smart-lsp}/util/subprocess_util.js +0 -0
- /package/dist/{solidlsp → smart-lsp}/util/zip.d.ts +0 -0
- /package/dist/{solidlsp → smart-lsp}/util/zip.js +0 -0
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { spawnSync } from 'node:child_process';
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
|
-
import {
|
|
4
|
+
import { createSmartEditLogger } from '../../smart-edit/util/logging.js';
|
|
5
5
|
import { Language } from '../ls_config.js';
|
|
6
6
|
import { ensureDefaultSubprocessOptions } from '../util/subprocess_util.js';
|
|
7
|
-
import {
|
|
7
|
+
import { SmartLanguageServer, SmartLspSettings, registerLanguageServer, coerceLogLevel } from '../ls.js';
|
|
8
8
|
import { NodeLanguageServerHandler } from '../ls_handler.js';
|
|
9
9
|
import { RuntimeDependencyCollection, quoteWindowsPath } from './common.js';
|
|
10
10
|
const VTS_DEPENDENCIES = [
|
|
11
11
|
{
|
|
12
12
|
id: 'vtsls',
|
|
13
|
-
command: 'npm install --prefix ./ @vtsls/language-server@0.
|
|
13
|
+
command: 'npm install --prefix ./ @vtsls/language-server@0.3.0',
|
|
14
14
|
platformId: 'any'
|
|
15
15
|
}
|
|
16
16
|
];
|
|
@@ -19,7 +19,7 @@ function commandExists(command) {
|
|
|
19
19
|
return spawnSync(locator, [command], ensureDefaultSubprocessOptions({ stdio: 'ignore' })).status === 0;
|
|
20
20
|
}
|
|
21
21
|
function ensureNodeTooling() {
|
|
22
|
-
if (process.env.
|
|
22
|
+
if (process.env.SMART_EDIT_ASSUME_VTSLS === '1') {
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
25
|
if (!commandExists('node')) {
|
|
@@ -49,8 +49,8 @@ function resolveBinaryPath(runtimeDir) {
|
|
|
49
49
|
return path.join(base, 'vtsls');
|
|
50
50
|
}
|
|
51
51
|
function ensureVtslsBinary(runtimeDir, dependencies, loggerLevel) {
|
|
52
|
-
const { logger } =
|
|
53
|
-
name: '
|
|
52
|
+
const { logger } = createSmartEditLogger({
|
|
53
|
+
name: 'smart-lsp.language_servers.vtsls',
|
|
54
54
|
emitToConsole: false,
|
|
55
55
|
level: loggerLevel === undefined ? undefined : coerceLogLevel(loggerLevel)
|
|
56
56
|
});
|
|
@@ -58,7 +58,7 @@ function ensureVtslsBinary(runtimeDir, dependencies, loggerLevel) {
|
|
|
58
58
|
if (fs.existsSync(binaryPath)) {
|
|
59
59
|
return binaryPath;
|
|
60
60
|
}
|
|
61
|
-
if (process.env.
|
|
61
|
+
if (process.env.SMART_EDIT_SKIP_RUNTIME_INSTALL === '1') {
|
|
62
62
|
throw new Error(`vtsls executable not found at ${binaryPath}. Allow downloads or install @vtsls/language-server manually.`);
|
|
63
63
|
}
|
|
64
64
|
ensureNodeTooling();
|
|
@@ -82,14 +82,14 @@ function mergeIgnoredPaths(existing) {
|
|
|
82
82
|
['node_modules', 'dist', 'build', 'coverage'].forEach((entry) => merged.add(entry));
|
|
83
83
|
return Array.from(merged);
|
|
84
84
|
}
|
|
85
|
-
export class VtsLanguageServer extends
|
|
85
|
+
export class VtsLanguageServer extends SmartLanguageServer {
|
|
86
86
|
handler;
|
|
87
87
|
constructor(config, loggerLike, repositoryRootPath, options = {}) {
|
|
88
88
|
const augmentedConfig = {
|
|
89
89
|
...config,
|
|
90
90
|
ignoredPaths: mergeIgnoredPaths(config.ignoredPaths)
|
|
91
91
|
};
|
|
92
|
-
const solidSettings = new
|
|
92
|
+
const solidSettings = new SmartLspSettings(options?.smartLspSettings);
|
|
93
93
|
const runtimeDir = resolveRuntimeDirectory(solidSettings);
|
|
94
94
|
const dependencies = new RuntimeDependencyCollection(VTS_DEPENDENCIES);
|
|
95
95
|
const binaryPath = ensureVtslsBinary(runtimeDir, dependencies, loggerLike?.level);
|
|
@@ -100,7 +100,7 @@ export class VtsLanguageServer extends SolidLanguageServer {
|
|
|
100
100
|
super(augmentedConfig, loggerLike, repositoryRootPath, {
|
|
101
101
|
...options,
|
|
102
102
|
handler,
|
|
103
|
-
|
|
103
|
+
smartLspSettings: options?.smartLspSettings
|
|
104
104
|
});
|
|
105
105
|
this.handler = handler;
|
|
106
106
|
this.registerHandlers();
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { LogLevel } from '../../
|
|
2
|
-
import {
|
|
1
|
+
import type { LogLevel } from '../../smart-edit/util/logging.js';
|
|
2
|
+
import { SmartLanguageServer, type LanguageServerConfigLike, type SmartLspSettingsInit } from '../ls.js';
|
|
3
3
|
import { NodeLanguageServerHandler } from '../ls_handler.js';
|
|
4
|
-
export declare class ZigLanguageServer extends
|
|
4
|
+
export declare class ZigLanguageServer extends SmartLanguageServer {
|
|
5
5
|
protected readonly handler: NodeLanguageServerHandler;
|
|
6
6
|
private initialized;
|
|
7
7
|
constructor(config: LanguageServerConfigLike, loggerLike: {
|
|
8
8
|
level?: number | LogLevel;
|
|
9
9
|
} | null, repositoryRootPath: string, options?: {
|
|
10
10
|
timeout?: number | null;
|
|
11
|
-
|
|
11
|
+
smartLspSettings?: SmartLspSettingsInit;
|
|
12
12
|
});
|
|
13
13
|
start(): this;
|
|
14
14
|
stop(shutdownTimeout?: number): void;
|
|
@@ -4,15 +4,15 @@ import path from 'node:path';
|
|
|
4
4
|
import { pathToFileURL } from 'node:url';
|
|
5
5
|
import { ensureDefaultSubprocessOptions } from '../util/subprocess_util.js';
|
|
6
6
|
import { Language } from '../ls_config.js';
|
|
7
|
-
import {
|
|
7
|
+
import { SmartLanguageServer, registerLanguageServer } from '../ls.js';
|
|
8
8
|
import { NodeLanguageServerHandler } from '../ls_handler.js';
|
|
9
9
|
import { quoteWindowsPath } from './common.js';
|
|
10
|
-
const ZLS_ASSUME_ENV = '
|
|
11
|
-
const ZLS_PATH_ENV = '
|
|
12
|
-
const ZIG_PATH_ENV = '
|
|
10
|
+
const ZLS_ASSUME_ENV = 'SMART_EDIT_ASSUME_ZLS';
|
|
11
|
+
const ZLS_PATH_ENV = 'SMART_EDIT_ZLS_PATH';
|
|
12
|
+
const ZIG_PATH_ENV = 'SMART_EDIT_ZIG_PATH';
|
|
13
13
|
const WINDOWS_UNSUPPORTED_MESSAGE = 'Windows is not supported by the Zig Language Server integration. Cross-file references are unreliable on Windows.';
|
|
14
14
|
const ZIG_IGNORED_DIRECTORIES = ['zig-cache', '.zig-cache', 'zig-out', 'node_modules', 'build', 'dist'];
|
|
15
|
-
export class ZigLanguageServer extends
|
|
15
|
+
export class ZigLanguageServer extends SmartLanguageServer {
|
|
16
16
|
handler;
|
|
17
17
|
initialized = false;
|
|
18
18
|
constructor(config, loggerLike, repositoryRootPath, options = {}) {
|
|
@@ -28,7 +28,7 @@ export class ZigLanguageServer extends SolidLanguageServer {
|
|
|
28
28
|
super(augmentedConfig, loggerLike, repositoryRootPath, {
|
|
29
29
|
...options,
|
|
30
30
|
handler,
|
|
31
|
-
|
|
31
|
+
smartLspSettings: options?.smartLspSettings
|
|
32
32
|
});
|
|
33
33
|
this.handler = handler;
|
|
34
34
|
this.registerHandlers();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { MatchedConsecutiveLines } from '../
|
|
2
|
-
import { type LogLevel, type
|
|
3
|
-
import { type PathMatcher } from '../
|
|
1
|
+
import { MatchedConsecutiveLines } from '../smart-edit/text_utils.js';
|
|
2
|
+
import { type LogLevel, type SmartEditLogger } from '../smart-edit/util/logging.js';
|
|
3
|
+
import { type PathMatcher } from '../smart-edit/util/file_system.js';
|
|
4
4
|
import type { Language } from './ls_config.js';
|
|
5
5
|
export interface LanguageServerConfig {
|
|
6
6
|
codeLanguage: Language;
|
|
@@ -14,16 +14,16 @@ export interface LanguageServerConfigLike {
|
|
|
14
14
|
startIndependentLspProcess?: boolean;
|
|
15
15
|
ignoredPaths?: string[];
|
|
16
16
|
}
|
|
17
|
-
export interface
|
|
18
|
-
|
|
17
|
+
export interface SmartLspSettingsInit {
|
|
18
|
+
smartLspDir?: string;
|
|
19
19
|
projectDataRelativePath?: string;
|
|
20
20
|
lsSpecificSettings?: Record<string, unknown>;
|
|
21
21
|
}
|
|
22
|
-
export declare class
|
|
23
|
-
readonly
|
|
22
|
+
export declare class SmartLspSettings {
|
|
23
|
+
readonly smartLspDir: string;
|
|
24
24
|
readonly projectDataRelativePath: string;
|
|
25
25
|
readonly lsSpecificSettings: Record<string, unknown>;
|
|
26
|
-
constructor(init?:
|
|
26
|
+
constructor(init?: SmartLspSettingsInit);
|
|
27
27
|
get languageServersStaticDir(): string;
|
|
28
28
|
}
|
|
29
29
|
export declare function coerceLogLevel(value: LogLevel | number | undefined): LogLevel;
|
|
@@ -107,14 +107,14 @@ export interface DocumentSymbolResult {
|
|
|
107
107
|
documentSymbols: UnifiedSymbolInformation[];
|
|
108
108
|
outlineSymbols: UnifiedSymbolInformation[];
|
|
109
109
|
}
|
|
110
|
-
export interface
|
|
110
|
+
export interface SmartLanguageServerNotifications {
|
|
111
111
|
initialized(params: unknown): void;
|
|
112
112
|
exit(): void;
|
|
113
113
|
didOpenTextDocument(params: DidOpenTextDocumentParams): void;
|
|
114
114
|
didChangeTextDocument(params: DidChangeTextDocumentParams): void;
|
|
115
115
|
didCloseTextDocument(params: DidCloseTextDocumentParams): void;
|
|
116
116
|
}
|
|
117
|
-
export interface
|
|
117
|
+
export interface SmartLanguageServerRequests {
|
|
118
118
|
documentSymbol(params: {
|
|
119
119
|
textDocument: {
|
|
120
120
|
uri: string;
|
|
@@ -126,42 +126,42 @@ export interface SolidLanguageServerRequests {
|
|
|
126
126
|
overview(relativeFilePath: string): Record<string, UnifiedSymbolInformation[]> | null;
|
|
127
127
|
shutdown(): void;
|
|
128
128
|
}
|
|
129
|
-
export interface
|
|
129
|
+
export interface SmartLanguageServerHandler {
|
|
130
130
|
setRequestTimeout(timeout: number | null): void;
|
|
131
131
|
isRunning(): boolean;
|
|
132
132
|
start(): void;
|
|
133
133
|
shutdown(): void;
|
|
134
134
|
dispose(): void;
|
|
135
|
-
readonly notify:
|
|
136
|
-
readonly send:
|
|
135
|
+
readonly notify: SmartLanguageServerNotifications;
|
|
136
|
+
readonly send: SmartLanguageServerRequests;
|
|
137
137
|
}
|
|
138
|
-
export interface
|
|
138
|
+
export interface SmartLanguageServerOptions {
|
|
139
139
|
timeout?: number | null;
|
|
140
|
-
|
|
141
|
-
handler?:
|
|
140
|
+
smartLspSettings?: SmartLspSettingsInit;
|
|
141
|
+
handler?: SmartLanguageServerHandler;
|
|
142
142
|
}
|
|
143
|
-
export type
|
|
143
|
+
export type SmartLanguageServerConstructor = new (config: LanguageServerConfigLike, loggerLike: {
|
|
144
144
|
level?: LogLevel | number;
|
|
145
|
-
} | null, repositoryRootPath: string, options?:
|
|
146
|
-
export declare class
|
|
145
|
+
} | null, repositoryRootPath: string, options?: SmartLanguageServerOptions) => SmartLanguageServer;
|
|
146
|
+
export declare class SmartLanguageServer {
|
|
147
147
|
static readonly CACHE_FOLDER_NAME = "cache";
|
|
148
148
|
protected readonly repositoryRootPath: string;
|
|
149
|
-
protected readonly logger:
|
|
149
|
+
protected readonly logger: SmartEditLogger;
|
|
150
150
|
protected readonly language: Language;
|
|
151
151
|
private readonly languageMatcher;
|
|
152
152
|
private readonly ignoreMatcher;
|
|
153
|
-
protected readonly handler:
|
|
154
|
-
protected readonly
|
|
153
|
+
protected readonly handler: SmartLanguageServerHandler;
|
|
154
|
+
protected readonly smartLspSettings: SmartLspSettings;
|
|
155
155
|
private readonly documentSymbolsCache;
|
|
156
156
|
private serverStarted;
|
|
157
157
|
private cacheHasChanged;
|
|
158
158
|
private readonly openFileBuffers;
|
|
159
159
|
constructor(config: LanguageServerConfigLike, loggerLike: {
|
|
160
160
|
level?: LogLevel | number;
|
|
161
|
-
} | null, repositoryRootPath: string, options?:
|
|
161
|
+
} | null, repositoryRootPath: string, options?: SmartLanguageServerOptions);
|
|
162
162
|
static create(config: LanguageServerConfigLike, loggerLike: {
|
|
163
163
|
level?: LogLevel | number;
|
|
164
|
-
} | null, repositoryRootPath: string, options?:
|
|
164
|
+
} | null, repositoryRootPath: string, options?: SmartLanguageServerOptions): SmartLanguageServer;
|
|
165
165
|
start(): this;
|
|
166
166
|
stop(shutdownTimeout?: number): void;
|
|
167
167
|
isRunning(): boolean;
|
|
@@ -194,4 +194,4 @@ export declare class SolidLanguageServer {
|
|
|
194
194
|
private loadCache;
|
|
195
195
|
private get cachePath();
|
|
196
196
|
}
|
|
197
|
-
export declare function registerLanguageServer(language: Language, ctor:
|
|
197
|
+
export declare function registerLanguageServer(language: Language, ctor: SmartLanguageServerConstructor): void;
|
|
@@ -3,23 +3,23 @@ import fs from 'node:fs';
|
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { pathToFileURL } from 'node:url';
|
|
5
5
|
import ignore from 'ignore';
|
|
6
|
-
import { MatchedConsecutiveLines } from '../
|
|
7
|
-
import {
|
|
8
|
-
import { matchPath } from '../
|
|
6
|
+
import { MatchedConsecutiveLines } from '../smart-edit/text_utils.js';
|
|
7
|
+
import { createSmartEditLogger } from '../smart-edit/util/logging.js';
|
|
8
|
+
import { matchPath } from '../smart-edit/util/file_system.js';
|
|
9
9
|
import { getLanguageFilenameMatcher } from './ls_config.js';
|
|
10
|
-
export class
|
|
11
|
-
|
|
10
|
+
export class SmartLspSettings {
|
|
11
|
+
smartLspDir;
|
|
12
12
|
projectDataRelativePath;
|
|
13
13
|
lsSpecificSettings;
|
|
14
14
|
constructor(init = {}) {
|
|
15
|
-
this.
|
|
16
|
-
this.projectDataRelativePath = init.projectDataRelativePath ?? '.
|
|
15
|
+
this.smartLspDir = init.smartLspDir ?? path.join(path.resolve(process.env.HOME ?? '.'), '.smart-lsp');
|
|
16
|
+
this.projectDataRelativePath = init.projectDataRelativePath ?? '.smart-lsp';
|
|
17
17
|
this.lsSpecificSettings = { ...(init.lsSpecificSettings ?? {}) };
|
|
18
|
-
fs.mkdirSync(this.
|
|
18
|
+
fs.mkdirSync(this.smartLspDir, { recursive: true });
|
|
19
19
|
fs.mkdirSync(this.languageServersStaticDir, { recursive: true });
|
|
20
20
|
}
|
|
21
21
|
get languageServersStaticDir() {
|
|
22
|
-
return path.join(this.
|
|
22
|
+
return path.join(this.smartLspDir, 'language_servers', 'static');
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
function logWithLevel(logger, level, message, meta) {
|
|
@@ -191,7 +191,7 @@ function deleteTextBetweenPositions(text, start, end) {
|
|
|
191
191
|
const updated = `${text.slice(0, startIndex)}${text.slice(endIndex)}`;
|
|
192
192
|
return { contents: updated, deleted };
|
|
193
193
|
}
|
|
194
|
-
export class
|
|
194
|
+
export class SmartLanguageServer {
|
|
195
195
|
static CACHE_FOLDER_NAME = 'cache';
|
|
196
196
|
repositoryRootPath;
|
|
197
197
|
logger;
|
|
@@ -199,7 +199,7 @@ export class SolidLanguageServer {
|
|
|
199
199
|
languageMatcher;
|
|
200
200
|
ignoreMatcher;
|
|
201
201
|
handler;
|
|
202
|
-
|
|
202
|
+
smartLspSettings;
|
|
203
203
|
documentSymbolsCache = new Map();
|
|
204
204
|
serverStarted = false;
|
|
205
205
|
cacheHasChanged = false;
|
|
@@ -219,17 +219,17 @@ export class SolidLanguageServer {
|
|
|
219
219
|
return ignoreInstance.ignores(normalizedCandidate);
|
|
220
220
|
}
|
|
221
221
|
};
|
|
222
|
-
const { logger } =
|
|
222
|
+
const { logger } = createSmartEditLogger({
|
|
223
223
|
level: coerceLogLevel(loggerLike?.level),
|
|
224
224
|
emitToConsole: false,
|
|
225
|
-
name: '
|
|
225
|
+
name: 'smart-lsp.language_server'
|
|
226
226
|
});
|
|
227
227
|
this.logger = logger;
|
|
228
228
|
this.handler = options.handler ?? new NullLanguageServerHandler();
|
|
229
229
|
if (options.timeout !== undefined) {
|
|
230
230
|
this.handler.setRequestTimeout(options.timeout ?? null);
|
|
231
231
|
}
|
|
232
|
-
this.
|
|
232
|
+
this.smartLspSettings = new SmartLspSettings(options.smartLspSettings);
|
|
233
233
|
this.loadCache();
|
|
234
234
|
}
|
|
235
235
|
static create(config, loggerLike, repositoryRootPath, options = {}) {
|
|
@@ -240,7 +240,7 @@ export class SolidLanguageServer {
|
|
|
240
240
|
if (this.serverStarted) {
|
|
241
241
|
return this;
|
|
242
242
|
}
|
|
243
|
-
logWithLevel(this.logger, 'info', `Starting
|
|
243
|
+
logWithLevel(this.logger, 'info', `Starting SmartLanguageServer for ${this.repositoryRootPath}`);
|
|
244
244
|
this.handler.start();
|
|
245
245
|
this.serverStarted = true;
|
|
246
246
|
return this;
|
|
@@ -249,7 +249,7 @@ export class SolidLanguageServer {
|
|
|
249
249
|
if (!this.serverStarted) {
|
|
250
250
|
return;
|
|
251
251
|
}
|
|
252
|
-
logWithLevel(this.logger, 'debug', `Stopping
|
|
252
|
+
logWithLevel(this.logger, 'debug', `Stopping SmartLanguageServer (timeout=${shutdownTimeout}s)`);
|
|
253
253
|
for (const buffer of this.openFileBuffers.values()) {
|
|
254
254
|
this.handler.notify.didCloseTextDocument({
|
|
255
255
|
textDocument: { uri: buffer.uri }
|
|
@@ -476,11 +476,11 @@ export class SolidLanguageServer {
|
|
|
476
476
|
}
|
|
477
477
|
}
|
|
478
478
|
catch (error) {
|
|
479
|
-
logWithLevel(this.logger, 'warn', `Failed to load
|
|
479
|
+
logWithLevel(this.logger, 'warn', `Failed to load SmartLSP cache from ${cachePath}`, error);
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
482
|
get cachePath() {
|
|
483
|
-
return path.join(this.repositoryRootPath, this.
|
|
483
|
+
return path.join(this.repositoryRootPath, this.smartLspSettings.projectDataRelativePath, SmartLanguageServer.CACHE_FOLDER_NAME, this.language, 'document_symbols_cache.json');
|
|
484
484
|
}
|
|
485
485
|
}
|
|
486
486
|
const LANGUAGE_SERVER_REGISTRY = new Map();
|
|
@@ -488,7 +488,7 @@ export function registerLanguageServer(language, ctor) {
|
|
|
488
488
|
LANGUAGE_SERVER_REGISTRY.set(language, ctor);
|
|
489
489
|
}
|
|
490
490
|
function getLanguageServerConstructor(language) {
|
|
491
|
-
return LANGUAGE_SERVER_REGISTRY.get(language) ??
|
|
491
|
+
return LANGUAGE_SERVER_REGISTRY.get(language) ?? SmartLanguageServer;
|
|
492
492
|
}
|
|
493
493
|
function deepClone(value) {
|
|
494
494
|
return value === undefined ? value : JSON.parse(JSON.stringify(value));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export class
|
|
1
|
+
export class SmartLSPException extends Error {
|
|
2
2
|
cause;
|
|
3
3
|
constructor(message, cause) {
|
|
4
4
|
super(message);
|
|
5
|
-
this.name = '
|
|
5
|
+
this.name = 'SmartLSPException';
|
|
6
6
|
this.cause = cause;
|
|
7
7
|
}
|
|
8
8
|
isLanguageServerTerminated() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type DocumentSymbolRequestParams, type LanguageServerRequestDelegate } from './ls_request.js';
|
|
2
2
|
import { LSPError, type PayloadLike, type ProcessLaunchInfo } from './lsp_protocol_handler/server.js';
|
|
3
|
-
import type { DocumentSymbolResult, FullSymbolTreeOptions, ReferenceInSymbol, ReferencingSymbolsOptions,
|
|
3
|
+
import type { DocumentSymbolResult, FullSymbolTreeOptions, ReferenceInSymbol, ReferencingSymbolsOptions, SmartLanguageServerHandler, SmartLanguageServerNotifications, SmartLanguageServerRequests, UnifiedSymbolInformation } from './ls.js';
|
|
4
4
|
type WireLogger = (source: string, destination: string, payload: unknown) => void;
|
|
5
5
|
export declare class LanguageServerTerminatedException extends Error {
|
|
6
6
|
readonly cause?: Error;
|
|
@@ -11,9 +11,9 @@ export interface NodeLanguageServerHandlerOptions {
|
|
|
11
11
|
startIndependentProcessGroup?: boolean;
|
|
12
12
|
requestTimeoutSeconds?: number | null;
|
|
13
13
|
}
|
|
14
|
-
export declare class NodeLanguageServerHandler implements
|
|
15
|
-
readonly send:
|
|
16
|
-
readonly notify:
|
|
14
|
+
export declare class NodeLanguageServerHandler implements SmartLanguageServerHandler, LanguageServerRequestDelegate {
|
|
15
|
+
readonly send: SmartLanguageServerRequests;
|
|
16
|
+
readonly notify: SmartLanguageServerNotifications;
|
|
17
17
|
private readonly processLaunchInfo;
|
|
18
18
|
private readonly logger?;
|
|
19
19
|
private readonly startIndependentProcessGroup;
|
|
@@ -32,9 +32,9 @@ export declare class NodeLanguageServerHandler implements SolidLanguageServerHan
|
|
|
32
32
|
shutdown(): void;
|
|
33
33
|
dispose(): void;
|
|
34
34
|
sendRequest(method: 'textDocument/documentSymbol', params: DocumentSymbolRequestParams): DocumentSymbolResult | null;
|
|
35
|
-
sendRequest(method: '
|
|
36
|
-
sendRequest(method: '
|
|
37
|
-
sendRequest(method: '
|
|
35
|
+
sendRequest(method: 'smart-edit/fullSymbolTree', params: FullSymbolTreeOptions): UnifiedSymbolInformation[] | null;
|
|
36
|
+
sendRequest(method: 'smart-edit/referencingSymbols', params: ReferencingSymbolsOptions): ReferenceInSymbol[] | null;
|
|
37
|
+
sendRequest(method: 'smart-edit/overview', params: string): Record<string, UnifiedSymbolInformation[]> | null;
|
|
38
38
|
sendRequest(method: 'shutdown'): void;
|
|
39
39
|
sendRequest(method: string, params?: unknown): unknown;
|
|
40
40
|
private waitForResponse;
|
|
@@ -2,7 +2,7 @@ import { spawn } from 'node:child_process';
|
|
|
2
2
|
import { Buffer } from 'node:buffer';
|
|
3
3
|
import fs from 'node:fs';
|
|
4
4
|
import { ensureDefaultSubprocessOptions } from './util/subprocess_util.js';
|
|
5
|
-
import {
|
|
5
|
+
import { SmartLSPException } from './ls_exceptions.js';
|
|
6
6
|
import { LspNotification, LanguageServerRequest } from './ls_request.js';
|
|
7
7
|
import { ErrorCodes } from './ls_types.js';
|
|
8
8
|
import { ENCODING, LSPError, createMessage, makeErrorResponse, makeNotification, makeRequest, makeResponse } from './lsp_protocol_handler/server.js';
|
|
@@ -160,7 +160,7 @@ export class NodeLanguageServerHandler {
|
|
|
160
160
|
sendRequest(method, params) {
|
|
161
161
|
const child = this.child;
|
|
162
162
|
if (!child?.stdin || this.stdoutFd === null) {
|
|
163
|
-
throw new
|
|
163
|
+
throw new SmartLSPException('Language server is not running.');
|
|
164
164
|
}
|
|
165
165
|
const id = this.requestId;
|
|
166
166
|
this.requestId += 1;
|
|
@@ -171,11 +171,11 @@ export class NodeLanguageServerHandler {
|
|
|
171
171
|
switch (method) {
|
|
172
172
|
case 'textDocument/documentSymbol':
|
|
173
173
|
return (response ?? null);
|
|
174
|
-
case '
|
|
174
|
+
case 'smart-edit/fullSymbolTree':
|
|
175
175
|
return (response ?? null);
|
|
176
|
-
case '
|
|
176
|
+
case 'smart-edit/referencingSymbols':
|
|
177
177
|
return (response ?? null);
|
|
178
|
-
case '
|
|
178
|
+
case 'smart-edit/overview':
|
|
179
179
|
return (response ?? null);
|
|
180
180
|
case 'shutdown':
|
|
181
181
|
return undefined;
|
|
@@ -202,7 +202,7 @@ export class NodeLanguageServerHandler {
|
|
|
202
202
|
if (response.id === requestId) {
|
|
203
203
|
const errorPayload = (response.error ?? {});
|
|
204
204
|
const lspError = LSPError.fromLsp(errorPayload);
|
|
205
|
-
throw new
|
|
205
|
+
throw new SmartLSPException(`Error processing request ${method}`, lspError);
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
if (isJsonRpcRequest(message)) {
|
|
@@ -218,7 +218,7 @@ export class NodeLanguageServerHandler {
|
|
|
218
218
|
readNextMessage(deadline) {
|
|
219
219
|
const fd = this.stdoutFd;
|
|
220
220
|
if (fd === null) {
|
|
221
|
-
throw new
|
|
221
|
+
throw new SmartLSPException('Language server stdout is not available.');
|
|
222
222
|
}
|
|
223
223
|
while (true) {
|
|
224
224
|
const message = this.extractMessageFromBuffer();
|
|
@@ -227,7 +227,7 @@ export class NodeLanguageServerHandler {
|
|
|
227
227
|
return message;
|
|
228
228
|
}
|
|
229
229
|
if (deadline !== null && Date.now() > deadline) {
|
|
230
|
-
throw new
|
|
230
|
+
throw new SmartLSPException(`Request timed out after ${this.requestTimeoutSeconds} seconds.`);
|
|
231
231
|
}
|
|
232
232
|
const chunk = Buffer.allocUnsafe(4096);
|
|
233
233
|
let bytesRead;
|
|
@@ -239,7 +239,7 @@ export class NodeLanguageServerHandler {
|
|
|
239
239
|
if (err.code === 'EAGAIN') {
|
|
240
240
|
continue;
|
|
241
241
|
}
|
|
242
|
-
throw new
|
|
242
|
+
throw new SmartLSPException('Failed to read from language server stdout.', err);
|
|
243
243
|
}
|
|
244
244
|
if (bytesRead === 0) {
|
|
245
245
|
if (!this.isRunning()) {
|
|
@@ -270,7 +270,7 @@ export class NodeLanguageServerHandler {
|
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
272
|
catch (error) {
|
|
273
|
-
throw new
|
|
273
|
+
throw new SmartLSPException('Invalid Content-Length header.', error);
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
if (contentLengthValue === null) {
|
|
@@ -288,7 +288,7 @@ export class NodeLanguageServerHandler {
|
|
|
288
288
|
return JSON.parse(body);
|
|
289
289
|
}
|
|
290
290
|
catch (error) {
|
|
291
|
-
throw new
|
|
291
|
+
throw new SmartLSPException('Malformed JSON payload received from language server.', error);
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
294
|
handleServerRequest(request) {
|
|
@@ -354,7 +354,7 @@ export class NodeLanguageServerHandler {
|
|
|
354
354
|
}
|
|
355
355
|
return;
|
|
356
356
|
}
|
|
357
|
-
throw new
|
|
357
|
+
throw new SmartLSPException('Failed to write to language server stdin.', err);
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
360
|
logWire(source, destination, payload) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DidChangeTextDocumentParams, DidCloseTextDocumentParams, DidOpenTextDocumentParams, DocumentSymbolResult, DocumentSymbolsOptions, FullSymbolTreeOptions, ReferenceInSymbol, ReferencingSymbolsOptions,
|
|
1
|
+
import type { DidChangeTextDocumentParams, DidCloseTextDocumentParams, DidOpenTextDocumentParams, DocumentSymbolResult, DocumentSymbolsOptions, FullSymbolTreeOptions, ReferenceInSymbol, ReferencingSymbolsOptions, SmartLanguageServerHandler, SmartLanguageServerNotifications, SmartLanguageServerRequests, UnifiedSymbolInformation } from './ls.js';
|
|
2
2
|
export interface DocumentSymbolRequestParams {
|
|
3
3
|
textDocument: {
|
|
4
4
|
uri: string;
|
|
@@ -8,7 +8,7 @@ export interface DocumentSymbolRequestParams {
|
|
|
8
8
|
export interface LanguageServerRequestDelegate {
|
|
9
9
|
sendRequest(method: string, params?: unknown): unknown;
|
|
10
10
|
}
|
|
11
|
-
export declare class LanguageServerRequest implements
|
|
11
|
+
export declare class LanguageServerRequest implements SmartLanguageServerRequests {
|
|
12
12
|
private readonly delegate;
|
|
13
13
|
constructor(handler: LanguageServerRequestDelegate);
|
|
14
14
|
documentSymbol(params: DocumentSymbolRequestParams): DocumentSymbolResult | null;
|
|
@@ -17,7 +17,7 @@ export declare class LanguageServerRequest implements SolidLanguageServerRequest
|
|
|
17
17
|
overview(relativeFilePath: string): Record<string, UnifiedSymbolInformation[]> | null;
|
|
18
18
|
shutdown(): void;
|
|
19
19
|
}
|
|
20
|
-
export declare class LspNotification implements
|
|
20
|
+
export declare class LspNotification implements SmartLanguageServerNotifications {
|
|
21
21
|
private readonly send;
|
|
22
22
|
constructor(sender: (method: string, params?: unknown) => void);
|
|
23
23
|
initialized(params?: unknown): void;
|
|
@@ -26,6 +26,6 @@ export declare class LspNotification implements SolidLanguageServerNotifications
|
|
|
26
26
|
didChangeTextDocument(params: DidChangeTextDocumentParams): void;
|
|
27
27
|
didCloseTextDocument(params: DidCloseTextDocumentParams): void;
|
|
28
28
|
}
|
|
29
|
-
export type
|
|
29
|
+
export type SmartLanguageServerHandlerLike = SmartLanguageServerHandler & {
|
|
30
30
|
sendRequest(method: string, params?: unknown): unknown;
|
|
31
31
|
};
|
|
@@ -7,13 +7,13 @@ export class LanguageServerRequest {
|
|
|
7
7
|
return this.delegate.sendRequest('textDocument/documentSymbol', params);
|
|
8
8
|
}
|
|
9
9
|
fullSymbolTree(params) {
|
|
10
|
-
return this.delegate.sendRequest('
|
|
10
|
+
return this.delegate.sendRequest('smart-edit/fullSymbolTree', params);
|
|
11
11
|
}
|
|
12
12
|
referencingSymbols(params) {
|
|
13
|
-
return this.delegate.sendRequest('
|
|
13
|
+
return this.delegate.sendRequest('smart-edit/referencingSymbols', params);
|
|
14
14
|
}
|
|
15
15
|
overview(relativeFilePath) {
|
|
16
|
-
return this.delegate.sendRequest('
|
|
16
|
+
return this.delegate.sendRequest('smart-edit/overview', relativeFilePath);
|
|
17
17
|
}
|
|
18
18
|
shutdown() {
|
|
19
19
|
void this.delegate.sendRequest('shutdown');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nogataka/smart-edit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Smart Edit is a tool for editing code with AI.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,9 +24,14 @@
|
|
|
24
24
|
"@dqbd/tiktoken": "^1.0.22",
|
|
25
25
|
"@modelcontextprotocol/sdk": "^1.16.0",
|
|
26
26
|
"adm-zip": "^0.5.16",
|
|
27
|
+
"chart.js": "^4.5.1",
|
|
28
|
+
"chartjs-plugin-datalabels": "^2.2.0",
|
|
27
29
|
"commander": "^12.1.0",
|
|
28
30
|
"ignore": "^7.0.5",
|
|
29
31
|
"nunjucks": "^3.2.4",
|
|
32
|
+
"react": "^19.2.4",
|
|
33
|
+
"react-chartjs-2": "^5.3.1",
|
|
34
|
+
"react-dom": "^19.2.4",
|
|
30
35
|
"tar": "^7.5.1",
|
|
31
36
|
"yaml": "^2.4.2",
|
|
32
37
|
"zod": "^3.25.0",
|
|
@@ -37,8 +42,11 @@
|
|
|
37
42
|
"@types/adm-zip": "^0.5.7",
|
|
38
43
|
"@types/node": "^20.11.0",
|
|
39
44
|
"@types/nunjucks": "^3.2.5",
|
|
45
|
+
"@types/react": "^19.2.10",
|
|
46
|
+
"@types/react-dom": "^19.2.3",
|
|
40
47
|
"@typescript-eslint/eslint-plugin": "^8.9.0",
|
|
41
48
|
"@typescript-eslint/parser": "^8.9.0",
|
|
49
|
+
"@vitejs/plugin-react": "^5.1.2",
|
|
42
50
|
"@vitest/coverage-v8": "^2.1.1",
|
|
43
51
|
"eslint": "^9.12.0",
|
|
44
52
|
"eslint-config-prettier": "^9.1.0",
|
|
@@ -48,10 +56,12 @@
|
|
|
48
56
|
"tslib": "^2.7.0",
|
|
49
57
|
"tsx": "^4.17.0",
|
|
50
58
|
"typescript": "5.5.4",
|
|
59
|
+
"vite": "^7.3.1",
|
|
51
60
|
"vitest": "^2.1.1"
|
|
52
61
|
},
|
|
53
62
|
"scripts": {
|
|
54
|
-
"build": "tsc -p tsconfig.build.json && node ./scripts/copy-resources.mjs",
|
|
63
|
+
"build": "tsc -p tsconfig.build.json && node ./scripts/copy-resources.mjs && pnpm build:dashboard",
|
|
64
|
+
"build:dashboard": "vite build --config src/smart-edit/dashboard-ui/vite.config.ts",
|
|
55
65
|
"clean": "rimraf dist",
|
|
56
66
|
"format": "prettier --write .",
|
|
57
67
|
"format:check": "prettier --check .",
|
|
@@ -59,7 +69,7 @@
|
|
|
59
69
|
"lint:fix": "pnpm lint --fix",
|
|
60
70
|
"test": "vitest run",
|
|
61
71
|
"test:watch": "vitest",
|
|
62
|
-
"typecheck": "tsc --noEmit",
|
|
72
|
+
"typecheck": "tsc --noEmit && tsc -p src/smart-edit/dashboard-ui --noEmit",
|
|
63
73
|
"prompts:generate": "tsx src/devtools/generate_prompt_factory.ts"
|
|
64
74
|
}
|
|
65
75
|
}
|