@askdkc/dsh-lsp-server 0.1.16 → 0.1.18
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/CHANGELOG.md +10 -0
- package/README.md +10 -4
- package/docs/usage.md +8 -4
- package/lib/{code-intelligence-BUs39chK.js → code-intelligence-BbjV-vXG.js} +244 -32
- package/lib/code-intelligence-BbjV-vXG.js.map +1 -0
- package/lib/code-intelligence.js +1 -1
- package/lib/extra-tool.js +15 -11
- package/lib/extra-tool.js.map +1 -1
- package/lib/grammars/manifest.json +180 -0
- package/lib/grammars/tree-sitter-bash.wasm +0 -0
- package/lib/grammars/tree-sitter-c.wasm +0 -0
- package/lib/grammars/tree-sitter-c_sharp.wasm +0 -0
- package/lib/grammars/tree-sitter-cpp.wasm +0 -0
- package/lib/grammars/tree-sitter-css.wasm +0 -0
- package/lib/grammars/tree-sitter-go.wasm +0 -0
- package/lib/grammars/tree-sitter-haskell.wasm +0 -0
- package/lib/grammars/tree-sitter-html.wasm +0 -0
- package/lib/grammars/tree-sitter-java.wasm +0 -0
- package/lib/grammars/tree-sitter-json.wasm +0 -0
- package/lib/grammars/tree-sitter-julia.wasm +0 -0
- package/lib/grammars/tree-sitter-ocaml.wasm +0 -0
- package/lib/grammars/tree-sitter-ocaml_interface.wasm +0 -0
- package/lib/grammars/tree-sitter-python.wasm +0 -0
- package/lib/grammars/tree-sitter-ql_dbscheme.wasm +0 -0
- package/lib/grammars/tree-sitter-ruby.wasm +0 -0
- package/lib/grammars/tree-sitter-rust.wasm +0 -0
- package/lib/grammars/tree-sitter-scala.wasm +0 -0
- package/lib/parser-worker.mjs +18 -0
- package/lib/provider.js +70 -2
- package/lib/provider.js.map +1 -1
- package/lib/types/extra-tool.d.ts +2 -1
- package/lib/types/servers/typescript-diagnostics.d.ts +3 -0
- package/lib/types/structure/types.d.ts +1 -1
- package/package.json +58 -30
- package/lib/code-intelligence-BUs39chK.js.map +0 -1
package/lib/extra-tool.js
CHANGED
|
@@ -8,9 +8,10 @@ const inject = [
|
|
|
8
8
|
"tools",
|
|
9
9
|
"systemPrompt",
|
|
10
10
|
"webstackLsp",
|
|
11
|
-
"codeIntelligenceRuntime"
|
|
11
|
+
"codeIntelligenceRuntime",
|
|
12
|
+
"workingDirectory"
|
|
12
13
|
];
|
|
13
|
-
function createExtraTool(service, codeIntelligence, config = {}) {
|
|
14
|
+
function createExtraTool(service, codeIntelligence, config = {}, workingDirectory) {
|
|
14
15
|
const limits = {
|
|
15
16
|
maxDiagnostics: 200,
|
|
16
17
|
maxCompletions: 100,
|
|
@@ -107,16 +108,16 @@ function createExtraTool(service, codeIntelligence, config = {}) {
|
|
|
107
108
|
if (!codeIntelligence) throw new WebstackLspError("LSP_CODE_INTELLIGENCE_UNAVAILABLE", "code-intelligence service is unavailable");
|
|
108
109
|
if (args.operation === "snapshot") if (args.action === "capabilities") result = codeIntelligence.capabilities();
|
|
109
110
|
else if (args.action === "open") {
|
|
110
|
-
const scope = snapshotScope(exec.agent);
|
|
111
|
+
const scope = snapshotScope(exec.agent, await resolveWorkspace(workingDirectory, exec.agent, signal));
|
|
111
112
|
if (typeof args.file_path !== "string") throw new TypeError("file_path is required for snapshot open");
|
|
112
113
|
result = await codeIntelligence.snapshot.open(scope, args.file_path, signal);
|
|
113
114
|
} else if (args.action === "release") {
|
|
114
|
-
const scope = snapshotScope(exec.agent);
|
|
115
|
+
const scope = snapshotScope(exec.agent, await resolveWorkspace(workingDirectory, exec.agent, signal));
|
|
115
116
|
if (typeof args.handle !== "string") throw new TypeError("handle is required for snapshot release");
|
|
116
117
|
result = await codeIntelligence.snapshot.release(scope, args.handle);
|
|
117
118
|
} else throw new TypeError("snapshot action must be open, release, or capabilities");
|
|
118
119
|
else {
|
|
119
|
-
const scope = snapshotScope(exec.agent);
|
|
120
|
+
const scope = snapshotScope(exec.agent, await resolveWorkspace(workingDirectory, exec.agent, signal));
|
|
120
121
|
if (args.operation === "structure") if (args.action === "outline") {
|
|
121
122
|
const range = readRange(args);
|
|
122
123
|
result = await codeIntelligence.structure.outline(scope, requiredString(args.handle, "handle"), {
|
|
@@ -151,8 +152,7 @@ function createExtraTool(service, codeIntelligence, config = {}) {
|
|
|
151
152
|
}
|
|
152
153
|
}
|
|
153
154
|
} else {
|
|
154
|
-
const workspaceRoot = exec.agent
|
|
155
|
-
if (!workspaceRoot) throw new WebstackLspError("LSP_WORKSPACE_REQUIRED", "lsp_extra requires a session workspace cwd");
|
|
155
|
+
const workspaceRoot = await resolveWorkspace(workingDirectory, exec.agent, signal);
|
|
156
156
|
if (!args.file_path) throw new TypeError("file_path is required");
|
|
157
157
|
if (args.operation === "diagnostics") {
|
|
158
158
|
const diagnostics = await service.diagnostics({
|
|
@@ -186,7 +186,7 @@ function createExtraTool(service, codeIntelligence, config = {}) {
|
|
|
186
186
|
});
|
|
187
187
|
}
|
|
188
188
|
function apply(ctx, config = {}) {
|
|
189
|
-
const tool = createExtraTool(ctx.webstackLsp, ctx.codeIntelligenceRuntime, config);
|
|
189
|
+
const tool = createExtraTool(ctx.webstackLsp, ctx.codeIntelligenceRuntime, config, ctx.workingDirectory);
|
|
190
190
|
ctx.tools.register(tool);
|
|
191
191
|
ctx.systemPrompt.section({
|
|
192
192
|
name: "tool:lsp_extra",
|
|
@@ -194,14 +194,18 @@ function apply(ctx, config = {}) {
|
|
|
194
194
|
text: "Use lsp_extra diagnostics after editing supported code files (PHP/Blade, TypeScript/JavaScript, JSX/TSX, Svelte, HTML, CSS/PCSS). Check status for supportedFileSuffixes, code-intelligence parser capabilities and server availability when uncertain. For Markdown and other unsupported documents, use content/structure checks instead. Open a snapshot before structure or semantic queries, pass its handle, and release it when finished. Structure/semantic positions and ranges are zero-based UTF-16; completion cursors remain one-based UTF-16. A skipped query is unverified, never a clean result; do not repeat an unsupported query unchanged. Query IDs are registered and cannot contain arbitrary Tree-sitter queries. The tool never applies edits."
|
|
195
195
|
});
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
async function resolveWorkspace(workingDirectory, agent, signal) {
|
|
198
|
+
if (!agent || !workingDirectory) throw new WebstackLspError("LSP_WORKSPACE_REQUIRED", "lsp_extra requires an active session and the workingDirectory service");
|
|
199
|
+
return workingDirectory.ensure(agent, signal);
|
|
200
|
+
}
|
|
201
|
+
function snapshotScope(agent, workspaceRoot) {
|
|
198
202
|
if (typeof agent !== "object" || agent === null) throw new WebstackLspError("LSP_WORKSPACE_REQUIRED", "snapshot operations require an active agent session");
|
|
199
203
|
const value = agent;
|
|
200
|
-
if (typeof value.id !== "string" || typeof value.session?.id !== "string"
|
|
204
|
+
if (typeof value.id !== "string" || typeof value.session?.id !== "string") throw new WebstackLspError("LSP_WORKSPACE_REQUIRED", "snapshot operations require trusted owner, session and workspace identity");
|
|
201
205
|
return {
|
|
202
206
|
ownerId: value.id,
|
|
203
207
|
sessionId: value.session.id,
|
|
204
|
-
workspaceRoot
|
|
208
|
+
workspaceRoot
|
|
205
209
|
};
|
|
206
210
|
}
|
|
207
211
|
function requiredString(value, name$1) {
|
package/lib/extra-tool.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extra-tool.js","names":["result: unknown","name"],"sources":["../src/extra-tool.ts"],"sourcesContent":["import type { Context } from '@deepseek-ai/cordis'\nimport { defineTool } from '@deepseek-ai/dsh-tools'\nimport type { ToolDefinition } from '@deepseek-ai/dsh-tools'\nimport type {} from '@deepseek-ai/dsh-system-prompt'\nimport type {} from './provider.js'\nimport type { WebstackLspService } from './service.js'\nimport { WebstackLspError } from './errors.js'\nimport { mergeDiagnostics } from './merge/diagnostics.js'\nimport { mergeCompletions } from './merge/completion.js'\nimport type { CodeIntelligenceToolServiceV1, SnapshotScope } from './structure/types.js'\n\nexport const name = 'lsp_extra'\nexport const inject = ['tools', 'systemPrompt', 'webstackLsp', 'codeIntelligenceRuntime']\nexport interface Config { maxDiagnostics?: number; maxCompletions?: number; maxResultChars?: number; timeoutMs?: number }\n\nexport function createExtraTool(service: WebstackLspService, codeIntelligence?: CodeIntelligenceToolServiceV1, config: Config = {}): ToolDefinition {\n const limits = { maxDiagnostics: 200, maxCompletions: 100, maxResultChars: 32000, timeoutMs: 60000, ...config }\n for (const [key, value] of Object.entries(limits)) if (!Number.isSafeInteger(value) || value < 1 || value > 2147483647) throw new TypeError(`${key} must be a positive integer no greater than 2147483647`)\n return defineTool({\n name,\n description: 'Read language-server status, diagnostics, or completion candidates for PHP/Blade, TypeScript/JavaScript, JSX/TSX, Svelte, HTML and CSS/PCSS. status reports supportedFileSuffixes and server availability. Unsupported document diagnostics return skipped (unverified). file_path is workspace-relative. Completion line and character are one-based UTF-16. No edits are applied.',\n parameters: {\n operation: { type: 'string', enum: ['status', 'diagnostics', 'completion', 'snapshot', 'structure', 'semantic'], required: true },\n action: { type: 'string', enum: ['open', 'release', 'capabilities', 'outline', 'enclosing', 'query', 'span', 'definition', 'references', 'implementation', 'hover', 'diagnostics', 'completion'] },\n file_path: { type: 'string' }, line: { type: 'integer' }, character: { type: 'integer' },\n handle: { type: 'string' }, node_handle: { type: 'string' }, query_id: { type: 'string' }, max_chars: { type: 'integer' }, limit: { type: 'integer' },\n position_line: { type: 'integer' }, position_character: { type: 'integer' },\n start_line: { type: 'integer' }, start_character: { type: 'integer' }, end_line: { type: 'integer' }, end_character: { type: 'integer' },\n kinds: { type: 'array', items: { type: 'string' } },\n severity: { type: 'string', enum: ['all', 'error', 'warning'] },\n servers: { type: 'array', items: { type: 'string' } },\n },\n output: {\n schema: { type: 'json' },\n render: (_args, value) => {\n const text = JSON.stringify(value)\n return [{ type: 'text', text: text.length <= limits.maxResultChars ? text : `${text.slice(0, Math.max(0, limits.maxResultChars - 14))}\\n[truncated]`.slice(0, limits.maxResultChars) }]\n },\n },\n timeoutMs: limits.timeoutMs,\n async execute(args, exec) {\n const signal = AbortSignal.any([exec.signal, AbortSignal.timeout(limits.timeoutMs)])\n signal.throwIfAborted()\n let result: unknown\n if (args.operation === 'status') result = { ...(await service.status()), ...(codeIntelligence ? { codeIntelligence: codeIntelligence.capabilities() } : {}) }\n else if (args.operation === 'snapshot' || args.operation === 'structure' || args.operation === 'semantic') {\n if (!codeIntelligence) throw new WebstackLspError('LSP_CODE_INTELLIGENCE_UNAVAILABLE', 'code-intelligence service is unavailable')\n if (args.operation === 'snapshot') {\n if (args.action === 'capabilities') result = codeIntelligence.capabilities()\n else if (args.action === 'open') {\n const scope = snapshotScope(exec.agent)\n if (typeof args.file_path !== 'string') throw new TypeError('file_path is required for snapshot open')\n result = await codeIntelligence.snapshot.open(scope, args.file_path, signal)\n } else if (args.action === 'release') {\n const scope = snapshotScope(exec.agent)\n if (typeof args.handle !== 'string') throw new TypeError('handle is required for snapshot release')\n result = await codeIntelligence.snapshot.release(scope, args.handle)\n } else throw new TypeError('snapshot action must be open, release, or capabilities')\n } else {\n const scope = snapshotScope(exec.agent)\n if (args.operation === 'structure') {\n if (args.action === 'outline') {\n const range = readRange(args)\n result = await codeIntelligence.structure.outline(scope, requiredString(args.handle, 'handle'), { ...(range ? { range } : {}), ...(args.limit === undefined ? {} : { limit: args.limit as number }) }, signal)\n }\n else if (args.action === 'enclosing') result = await codeIntelligence.structure.enclosing(scope, requiredString(args.handle, 'handle'), zeroBasedPosition(args), { ...(args.kinds === undefined ? {} : { kinds: args.kinds as string[] }) }, signal)\n else if (args.action === 'query') {\n const range = readRange(args)\n result = await codeIntelligence.structure.query(scope, requiredString(args.handle, 'handle'), requiredString(args.query_id, 'query_id'), { ...(range ? { range } : {}), ...(args.limit === undefined ? {} : { limit: args.limit as number }) }, signal)\n }\n else if (args.action === 'span') result = await codeIntelligence.structure.span(scope, requiredString(args.node_handle, 'node_handle'), args.max_chars as number | undefined, signal)\n else throw new TypeError('structure action must be outline, enclosing, query, or span')\n } else {\n const action = args.action\n if (!['definition', 'references', 'implementation', 'hover', 'diagnostics', 'completion'].includes(String(action))) throw new TypeError('unsupported semantic action')\n result = await codeIntelligence.semantic.query(scope, requiredString(args.handle, 'handle'), {\n operation: action as 'definition' | 'references' | 'implementation' | 'hover' | 'diagnostics' | 'completion',\n ...(action === 'diagnostics' ? {} : { position: zeroBasedPosition(args) }),\n ...(args.severity ? { severity: args.severity as 'all' | 'error' | 'warning' } : {}),\n ...(args.servers ? { servers: args.servers as string[] } : {}),\n }, signal)\n }\n }\n }\n else {\n const workspaceRoot = exec.agent?.session.header.cwd\n if (!workspaceRoot) throw new WebstackLspError('LSP_WORKSPACE_REQUIRED', 'lsp_extra requires a session workspace cwd')\n if (!args.file_path) throw new TypeError('file_path is required')\n if (args.operation === 'diagnostics') {\n const diagnostics = await service.diagnostics({ workspaceRoot, filePath: args.file_path, ...(args.severity ? { severity: args.severity } : {}), ...(args.servers ? { servers: args.servers } : {}) }, signal)\n result = { ...diagnostics, ...mergeDiagnostics([diagnostics.diagnostics], limits) }\n } else {\n if (!args.line || args.line < 1 || !args.character || args.character < 1) throw new TypeError('completion requires positive one-based line and character')\n const completion = await service.completion({ workspaceRoot, filePath: args.file_path, position: { line: args.line - 1, character: args.character - 1 } }, signal)\n result = { ...completion, ...mergeCompletions([completion.items], limits) }\n }\n }\n // Strip undefined optionals and expose a lossless JSON result to DSH's schema validator.\n return JSON.parse(JSON.stringify(result))\n },\n })\n}\n\nexport function apply(ctx: Context, config: Config = {}): void {\n const tool = createExtraTool(ctx.webstackLsp, ctx.codeIntelligenceRuntime, config)\n ctx.tools.register(tool)\n ctx.systemPrompt.section({ name: 'tool:lsp_extra', order: 500, text: 'Use lsp_extra diagnostics after editing supported code files (PHP/Blade, TypeScript/JavaScript, JSX/TSX, Svelte, HTML, CSS/PCSS). Check status for supportedFileSuffixes, code-intelligence parser capabilities and server availability when uncertain. For Markdown and other unsupported documents, use content/structure checks instead. Open a snapshot before structure or semantic queries, pass its handle, and release it when finished. Structure/semantic positions and ranges are zero-based UTF-16; completion cursors remain one-based UTF-16. A skipped query is unverified, never a clean result; do not repeat an unsupported query unchanged. Query IDs are registered and cannot contain arbitrary Tree-sitter queries. The tool never applies edits.' })\n}\n\nfunction snapshotScope(agent: unknown): SnapshotScope {\n if (typeof agent !== 'object' || agent === null) throw new WebstackLspError('LSP_WORKSPACE_REQUIRED', 'snapshot operations require an active agent session')\n const value = agent as { id?: unknown; session?: { id?: unknown; header?: { cwd?: unknown } } }\n if (typeof value.id !== 'string' || typeof value.session?.id !== 'string' || typeof value.session.header?.cwd !== 'string')\n throw new WebstackLspError('LSP_WORKSPACE_REQUIRED', 'snapshot operations require trusted owner, session and workspace identity')\n return { ownerId: value.id, sessionId: value.session.id, workspaceRoot: value.session.header.cwd }\n}\n\nfunction requiredString(value: unknown, name: string): string {\n if (typeof value !== 'string' || !value.trim()) throw new TypeError(`${name} is required`)\n return value\n}\n\nfunction zeroBasedPosition(args: Record<string, unknown>): { line: number; character: number } {\n if (!Number.isSafeInteger(args.position_line) || !Number.isSafeInteger(args.position_character) || (args.position_line as number) < 0 || (args.position_character as number) < 0)\n throw new TypeError('position_line and position_character must be zero-based non-negative UTF-16 offsets')\n return { line: args.position_line as number, character: args.position_character as number }\n}\n\nfunction readRange(args: Record<string, unknown>): { start: { line: number; character: number }; end: { line: number; character: number } } | undefined {\n const fields = [args.start_line, args.start_character, args.end_line, args.end_character]\n if (fields.every(value => value === undefined)) return undefined\n if (fields.some(value => !Number.isSafeInteger(value) || (value as number) < 0)) throw new TypeError('range requires four zero-based non-negative coordinates')\n return { start: { line: args.start_line as number, character: args.start_character as number }, end: { line: args.end_line as number, character: args.end_character as number } }\n}\n"],"mappings":";;;;;AAWA,MAAa,OAAO;AACpB,MAAa,SAAS;CAAC;CAAS;CAAgB;CAAe;CAA0B;AAGzF,SAAgB,gBAAgB,SAA6B,kBAAkD,SAAiB,EAAE,EAAkB;CAClJ,MAAM,SAAS;EAAE,gBAAgB;EAAK,gBAAgB;EAAK,gBAAgB;EAAO,WAAW;EAAO,GAAG;EAAQ;AAC/G,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,OAAO,CAAE,KAAI,CAAC,OAAO,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O,YAAY,OAAO,MAAM,QAAQ,QAAQ,QAAQ,SAChH,OAAM,IAAI,iBAAiB,0BAA0B,4EAA4E;AACnI,QAAO;EAAE,SAAS,MAAM;EAAI,WAAW,MAAM,QAAQ;EAAI,eAAe,MAAM,QAAQ,OAAO;EAAK;;AAGpG,SAAS,eAAe,OAAgB,QAAsB;AAC5D,KAAI,OAAO,UAAU,YAAY,CAAC,MAAM,MAAM,CAAE,OAAM,IAAI,UAAU,GAAGC,OAAK,cAAc;AAC1F,QAAO;;AAGT,SAAS,kBAAkB,MAAoE;AAC7F,KAAI,CAAC,OAAO,cAAc,KAAK,cAAc,IAAI,CAAC,OAAO,cAAc,KAAK,mBAAmB,IAAK,KAAK,gBAA2B,KAAM,KAAK,qBAAgC,EAC7K,OAAM,IAAI,UAAU,sFAAsF;AAC5G,QAAO;EAAE,MAAM,KAAK;EAAyB,WAAW,KAAK;EAA8B;;AAG7F,SAAS,UAAU,MAAqI;CACtJ,MAAM,SAAS;EAAC,KAAK;EAAY,KAAK;EAAiB,KAAK;EAAU,KAAK;EAAc;AACzF,KAAI,OAAO,OAAM,UAAS,UAAU,OAAU,CAAE,QAAO;AACvD,KAAI,OAAO,MAAK,UAAS,CAAC,OAAO,cAAc,MAAM,IAAK,QAAmB,EAAE,CAAE,OAAM,IAAI,UAAU,0DAA0D;AAC/J,QAAO;EAAE,OAAO;GAAE,MAAM,KAAK;GAAsB,WAAW,KAAK;GAA2B;EAAE,KAAK;GAAE,MAAM,KAAK;GAAoB,WAAW,KAAK;GAAyB;EAAE"}
|
|
1
|
+
{"version":3,"file":"extra-tool.js","names":["result: unknown","name"],"sources":["../src/extra-tool.ts"],"sourcesContent":["import type { Context } from '@deepseek-ai/cordis'\nimport { defineTool } from '@deepseek-ai/dsh-tools'\nimport type { ToolDefinition, ToolExecutionInput } from '@deepseek-ai/dsh-tools'\nimport type { WorkingDirectoryService } from '@deepseek-ai/dsh-working-directory'\nimport type {} from '@deepseek-ai/dsh-system-prompt'\nimport type {} from './provider.js'\nimport type { WebstackLspService } from './service.js'\nimport { WebstackLspError } from './errors.js'\nimport { mergeDiagnostics } from './merge/diagnostics.js'\nimport { mergeCompletions } from './merge/completion.js'\nimport type { CodeIntelligenceToolServiceV1, SnapshotScope } from './structure/types.js'\n\nexport const name = 'lsp_extra'\nexport const inject = ['tools', 'systemPrompt', 'webstackLsp', 'codeIntelligenceRuntime', 'workingDirectory']\nexport interface Config { maxDiagnostics?: number; maxCompletions?: number; maxResultChars?: number; timeoutMs?: number }\n\nexport function createExtraTool(service: WebstackLspService, codeIntelligence?: CodeIntelligenceToolServiceV1, config: Config = {}, workingDirectory?: Pick<WorkingDirectoryService, 'ensure'>): ToolDefinition {\n const limits = { maxDiagnostics: 200, maxCompletions: 100, maxResultChars: 32000, timeoutMs: 60000, ...config }\n for (const [key, value] of Object.entries(limits)) if (!Number.isSafeInteger(value) || value < 1 || value > 2147483647) throw new TypeError(`${key} must be a positive integer no greater than 2147483647`)\n return defineTool({\n name,\n description: 'Read language-server status, diagnostics, or completion candidates for PHP/Blade, TypeScript/JavaScript, JSX/TSX, Svelte, HTML and CSS/PCSS. status reports supportedFileSuffixes and server availability. Unsupported document diagnostics return skipped (unverified). file_path is workspace-relative. Completion line and character are one-based UTF-16. No edits are applied.',\n parameters: {\n operation: { type: 'string', enum: ['status', 'diagnostics', 'completion', 'snapshot', 'structure', 'semantic'], required: true },\n action: { type: 'string', enum: ['open', 'release', 'capabilities', 'outline', 'enclosing', 'query', 'span', 'definition', 'references', 'implementation', 'hover', 'diagnostics', 'completion'] },\n file_path: { type: 'string' }, line: { type: 'integer' }, character: { type: 'integer' },\n handle: { type: 'string' }, node_handle: { type: 'string' }, query_id: { type: 'string' }, max_chars: { type: 'integer' }, limit: { type: 'integer' },\n position_line: { type: 'integer' }, position_character: { type: 'integer' },\n start_line: { type: 'integer' }, start_character: { type: 'integer' }, end_line: { type: 'integer' }, end_character: { type: 'integer' },\n kinds: { type: 'array', items: { type: 'string' } },\n severity: { type: 'string', enum: ['all', 'error', 'warning'] },\n servers: { type: 'array', items: { type: 'string' } },\n },\n output: {\n schema: { type: 'json' },\n render: (_args, value) => {\n const text = JSON.stringify(value)\n return [{ type: 'text', text: text.length <= limits.maxResultChars ? text : `${text.slice(0, Math.max(0, limits.maxResultChars - 14))}\\n[truncated]`.slice(0, limits.maxResultChars) }]\n },\n },\n timeoutMs: limits.timeoutMs,\n async execute(args, exec) {\n const signal = AbortSignal.any([exec.signal, AbortSignal.timeout(limits.timeoutMs)])\n signal.throwIfAborted()\n let result: unknown\n if (args.operation === 'status') result = { ...(await service.status()), ...(codeIntelligence ? { codeIntelligence: codeIntelligence.capabilities() } : {}) }\n else if (args.operation === 'snapshot' || args.operation === 'structure' || args.operation === 'semantic') {\n if (!codeIntelligence) throw new WebstackLspError('LSP_CODE_INTELLIGENCE_UNAVAILABLE', 'code-intelligence service is unavailable')\n if (args.operation === 'snapshot') {\n if (args.action === 'capabilities') result = codeIntelligence.capabilities()\n else if (args.action === 'open') {\n const scope = snapshotScope(exec.agent, await resolveWorkspace(workingDirectory, exec.agent, signal))\n if (typeof args.file_path !== 'string') throw new TypeError('file_path is required for snapshot open')\n result = await codeIntelligence.snapshot.open(scope, args.file_path, signal)\n } else if (args.action === 'release') {\n const scope = snapshotScope(exec.agent, await resolveWorkspace(workingDirectory, exec.agent, signal))\n if (typeof args.handle !== 'string') throw new TypeError('handle is required for snapshot release')\n result = await codeIntelligence.snapshot.release(scope, args.handle)\n } else throw new TypeError('snapshot action must be open, release, or capabilities')\n } else {\n const scope = snapshotScope(exec.agent, await resolveWorkspace(workingDirectory, exec.agent, signal))\n if (args.operation === 'structure') {\n if (args.action === 'outline') {\n const range = readRange(args)\n result = await codeIntelligence.structure.outline(scope, requiredString(args.handle, 'handle'), { ...(range ? { range } : {}), ...(args.limit === undefined ? {} : { limit: args.limit as number }) }, signal)\n }\n else if (args.action === 'enclosing') result = await codeIntelligence.structure.enclosing(scope, requiredString(args.handle, 'handle'), zeroBasedPosition(args), { ...(args.kinds === undefined ? {} : { kinds: args.kinds as string[] }) }, signal)\n else if (args.action === 'query') {\n const range = readRange(args)\n result = await codeIntelligence.structure.query(scope, requiredString(args.handle, 'handle'), requiredString(args.query_id, 'query_id'), { ...(range ? { range } : {}), ...(args.limit === undefined ? {} : { limit: args.limit as number }) }, signal)\n }\n else if (args.action === 'span') result = await codeIntelligence.structure.span(scope, requiredString(args.node_handle, 'node_handle'), args.max_chars as number | undefined, signal)\n else throw new TypeError('structure action must be outline, enclosing, query, or span')\n } else {\n const action = args.action\n if (!['definition', 'references', 'implementation', 'hover', 'diagnostics', 'completion'].includes(String(action))) throw new TypeError('unsupported semantic action')\n result = await codeIntelligence.semantic.query(scope, requiredString(args.handle, 'handle'), {\n operation: action as 'definition' | 'references' | 'implementation' | 'hover' | 'diagnostics' | 'completion',\n ...(action === 'diagnostics' ? {} : { position: zeroBasedPosition(args) }),\n ...(args.severity ? { severity: args.severity as 'all' | 'error' | 'warning' } : {}),\n ...(args.servers ? { servers: args.servers as string[] } : {}),\n }, signal)\n }\n }\n }\n else {\n const workspaceRoot = await resolveWorkspace(workingDirectory, exec.agent, signal)\n if (!args.file_path) throw new TypeError('file_path is required')\n if (args.operation === 'diagnostics') {\n const diagnostics = await service.diagnostics({ workspaceRoot, filePath: args.file_path, ...(args.severity ? { severity: args.severity } : {}), ...(args.servers ? { servers: args.servers } : {}) }, signal)\n result = { ...diagnostics, ...mergeDiagnostics([diagnostics.diagnostics], limits) }\n } else {\n if (!args.line || args.line < 1 || !args.character || args.character < 1) throw new TypeError('completion requires positive one-based line and character')\n const completion = await service.completion({ workspaceRoot, filePath: args.file_path, position: { line: args.line - 1, character: args.character - 1 } }, signal)\n result = { ...completion, ...mergeCompletions([completion.items], limits) }\n }\n }\n // Strip undefined optionals and expose a lossless JSON result to DSH's schema validator.\n return JSON.parse(JSON.stringify(result))\n },\n })\n}\n\nexport function apply(ctx: Context, config: Config = {}): void {\n const tool = createExtraTool(ctx.webstackLsp, ctx.codeIntelligenceRuntime, config, ctx.workingDirectory)\n ctx.tools.register(tool)\n ctx.systemPrompt.section({ name: 'tool:lsp_extra', order: 500, text: 'Use lsp_extra diagnostics after editing supported code files (PHP/Blade, TypeScript/JavaScript, JSX/TSX, Svelte, HTML, CSS/PCSS). Check status for supportedFileSuffixes, code-intelligence parser capabilities and server availability when uncertain. For Markdown and other unsupported documents, use content/structure checks instead. Open a snapshot before structure or semantic queries, pass its handle, and release it when finished. Structure/semantic positions and ranges are zero-based UTF-16; completion cursors remain one-based UTF-16. A skipped query is unverified, never a clean result; do not repeat an unsupported query unchanged. Query IDs are registered and cannot contain arbitrary Tree-sitter queries. The tool never applies edits.' })\n}\n\nasync function resolveWorkspace(workingDirectory: Pick<WorkingDirectoryService, 'ensure'> | undefined, agent: ToolExecutionInput['agent'], signal: AbortSignal): Promise<string> {\n if (!agent || !workingDirectory) throw new WebstackLspError('LSP_WORKSPACE_REQUIRED', 'lsp_extra requires an active session and the workingDirectory service')\n return workingDirectory.ensure(agent, signal)\n}\n\nfunction snapshotScope(agent: unknown, workspaceRoot: string): SnapshotScope {\n if (typeof agent !== 'object' || agent === null) throw new WebstackLspError('LSP_WORKSPACE_REQUIRED', 'snapshot operations require an active agent session')\n const value = agent as { id?: unknown; session?: { id?: unknown } }\n if (typeof value.id !== 'string' || typeof value.session?.id !== 'string')\n throw new WebstackLspError('LSP_WORKSPACE_REQUIRED', 'snapshot operations require trusted owner, session and workspace identity')\n return { ownerId: value.id, sessionId: value.session.id, workspaceRoot }\n}\n\nfunction requiredString(value: unknown, name: string): string {\n if (typeof value !== 'string' || !value.trim()) throw new TypeError(`${name} is required`)\n return value\n}\n\nfunction zeroBasedPosition(args: Record<string, unknown>): { line: number; character: number } {\n if (!Number.isSafeInteger(args.position_line) || !Number.isSafeInteger(args.position_character) || (args.position_line as number) < 0 || (args.position_character as number) < 0)\n throw new TypeError('position_line and position_character must be zero-based non-negative UTF-16 offsets')\n return { line: args.position_line as number, character: args.position_character as number }\n}\n\nfunction readRange(args: Record<string, unknown>): { start: { line: number; character: number }; end: { line: number; character: number } } | undefined {\n const fields = [args.start_line, args.start_character, args.end_line, args.end_character]\n if (fields.every(value => value === undefined)) return undefined\n if (fields.some(value => !Number.isSafeInteger(value) || (value as number) < 0)) throw new TypeError('range requires four zero-based non-negative coordinates')\n return { start: { line: args.start_line as number, character: args.start_character as number }, end: { line: args.end_line as number, character: args.end_character as number } }\n}\n"],"mappings":";;;;;AAYA,MAAa,OAAO;AACpB,MAAa,SAAS;CAAC;CAAS;CAAgB;CAAe;CAA2B;CAAmB;AAG7G,SAAgB,gBAAgB,SAA6B,kBAAkD,SAAiB,EAAE,EAAE,kBAA4E;CAC9M,MAAM,SAAS;EAAE,gBAAgB;EAAK,gBAAgB;EAAK,gBAAgB;EAAO,WAAW;EAAO,GAAG;EAAQ;AAC/G,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,OAAO,CAAE,KAAI,CAAC,OAAO,cAAc,MAAM,IAAI,QAAQ,KAAK,QAAQ,WAAY,OAAM,IAAI,UAAU,GAAG,IAAI,wDAAwD;AAC3M,QAAO,WAAW;EAChB;EACA,aAAa;EACb,YAAY;GACV,WAAW;IAAE,MAAM;IAAU,MAAM;KAAC;KAAU;KAAe;KAAc;KAAY;KAAa;KAAW;IAAE,UAAU;IAAM;GACjI,QAAQ;IAAE,MAAM;IAAU,MAAM;KAAC;KAAQ;KAAW;KAAgB;KAAW;KAAa;KAAS;KAAQ;KAAc;KAAc;KAAkB;KAAS;KAAe;KAAa;IAAE;GAClM,WAAW,EAAE,MAAM,UAAU;GAAE,MAAM,EAAE,MAAM,WAAW;GAAE,WAAW,EAAE,MAAM,WAAW;GACxF,QAAQ,EAAE,MAAM,UAAU;GAAE,aAAa,EAAE,MAAM,UAAU;GAAE,UAAU,EAAE,MAAM,UAAU;GAAE,WAAW,EAAE,MAAM,WAAW;GAAE,OAAO,EAAE,MAAM,WAAW;GACrJ,eAAe,EAAE,MAAM,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O,cAAc,KAAK,mBAAmB,IAAK,KAAK,gBAA2B,KAAM,KAAK,qBAAgC,EAC7K,OAAM,IAAI,UAAU,sFAAsF;AAC5G,QAAO;EAAE,MAAM,KAAK;EAAyB,WAAW,KAAK;EAA8B;;AAG7F,SAAS,UAAU,MAAqI;CACtJ,MAAM,SAAS;EAAC,KAAK;EAAY,KAAK;EAAiB,KAAK;EAAU,KAAK;EAAc;AACzF,KAAI,OAAO,OAAM,UAAS,UAAU,OAAU,CAAE,QAAO;AACvD,KAAI,OAAO,MAAK,UAAS,CAAC,OAAO,cAAc,MAAM,IAAK,QAAmB,EAAE,CAAE,OAAM,IAAI,UAAU,0DAA0D;AAC/J,QAAO;EAAE,OAAO;GAAE,MAAM,KAAK;GAAsB,WAAW,KAAK;GAA2B;EAAE,KAAK;GAAE,MAAM,KAAK;GAAoB,WAAW,KAAK;GAAyB;EAAE"}
|
|
@@ -45,6 +45,186 @@
|
|
|
45
45
|
"abiVersion": 15,
|
|
46
46
|
"asset": "tree-sitter-php.wasm",
|
|
47
47
|
"sha256": "d4df6a6ff08c87c3ec4f9cbb785fe09998a0cb570e03f57d7b19b3acfb146aa7"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"language": "bash",
|
|
51
|
+
"package": "tree-sitter-bash",
|
|
52
|
+
"version": "0.25.1",
|
|
53
|
+
"sourceCommit": "801326684a26ffc4e749bb016c50c6c30bdfa345",
|
|
54
|
+
"license": "MIT",
|
|
55
|
+
"abiVersion": 15,
|
|
56
|
+
"asset": "tree-sitter-bash.wasm",
|
|
57
|
+
"sha256": "8292919c88a0f7d3fb31d0cd0253ca5a9531bc1ede82b0537f2c63dd8abe6a7a"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"language": "c",
|
|
61
|
+
"package": "tree-sitter-c",
|
|
62
|
+
"version": "0.24.1",
|
|
63
|
+
"sourceCommit": "7fa1be1b694b6e763686793d97da01f36a0e5c12",
|
|
64
|
+
"license": "MIT",
|
|
65
|
+
"abiVersion": 15,
|
|
66
|
+
"asset": "tree-sitter-c.wasm",
|
|
67
|
+
"sha256": "c852c2a85ebf2beb636aa3b0ef7f7e70458684d74f6741b20dcb296885bed9f9"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"language": "cpp",
|
|
71
|
+
"package": "tree-sitter-cpp",
|
|
72
|
+
"version": "0.23.4",
|
|
73
|
+
"sourceCommit": "f41e1a044c8a84ea9fa8577fdd2eab92ec96de02",
|
|
74
|
+
"license": "MIT",
|
|
75
|
+
"abiVersion": 14,
|
|
76
|
+
"asset": "tree-sitter-cpp.wasm",
|
|
77
|
+
"sha256": "174eb0deb75b2ec7881bcacda9f995648d8e683956e5c2267e69ab6dc503fcbf"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"language": "c_sharp",
|
|
81
|
+
"package": "tree-sitter-c-sharp",
|
|
82
|
+
"version": "0.23.5",
|
|
83
|
+
"sourceCommit": "cac6d5fb595f5811a076336682d5d595ac1c9e85",
|
|
84
|
+
"license": "MIT",
|
|
85
|
+
"abiVersion": 15,
|
|
86
|
+
"asset": "tree-sitter-c_sharp.wasm",
|
|
87
|
+
"sha256": "6f69e1cae44e1c32c1eccc170dc5a9778fb94ff716f71113fe1f8c4299aa2f40"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"language": "css",
|
|
91
|
+
"package": "tree-sitter-css",
|
|
92
|
+
"version": "0.25.0",
|
|
93
|
+
"sourceCommit": "dda5cfc5722c429eaba1c910ca32c2c0c5bb1a3f",
|
|
94
|
+
"license": "MIT",
|
|
95
|
+
"abiVersion": 15,
|
|
96
|
+
"asset": "tree-sitter-css.wasm",
|
|
97
|
+
"sha256": "8a23977fe271357cce6f254ef88c9bebf3854602d8046605aef6a45c02135c59"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"language": "go",
|
|
101
|
+
"package": "tree-sitter-go",
|
|
102
|
+
"version": "0.25.0",
|
|
103
|
+
"sourceCommit": "1547678a9da59885853f5f5cc8a99cc203fa2e2c",
|
|
104
|
+
"license": "MIT",
|
|
105
|
+
"abiVersion": 15,
|
|
106
|
+
"asset": "tree-sitter-go.wasm",
|
|
107
|
+
"sha256": "9504573f352b20be7f2f1911754d710622aedc15afff16d5ed8fb5645681aee7"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"language": "haskell",
|
|
111
|
+
"package": "tree-sitter-haskell",
|
|
112
|
+
"version": "0.23.1",
|
|
113
|
+
"sourceCommit": "c30d812bc90827f1a54106a25bc9a6307f5cdcec",
|
|
114
|
+
"license": "MIT",
|
|
115
|
+
"abiVersion": 14,
|
|
116
|
+
"asset": "tree-sitter-haskell.wasm",
|
|
117
|
+
"sha256": "37a6b07b1a838d02ffb4f4c2a06863637a8efe48432d60a275f50f1d08f1092c"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"language": "html",
|
|
121
|
+
"package": "tree-sitter-html",
|
|
122
|
+
"version": "0.23.2",
|
|
123
|
+
"sourceCommit": "5a5ca8551a179998360b4a4ca2c0f366a35acc03",
|
|
124
|
+
"license": "MIT",
|
|
125
|
+
"abiVersion": 14,
|
|
126
|
+
"asset": "tree-sitter-html.wasm",
|
|
127
|
+
"sha256": "c48fcd82c7ea8bf943180088ba7f28c48b2bb5287874179168bf9d31e394cf85"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"language": "java",
|
|
131
|
+
"package": "tree-sitter-java",
|
|
132
|
+
"version": "0.23.5",
|
|
133
|
+
"sourceCommit": "94703d5a6bed02b98e438d7cad1136c01a60ba2c",
|
|
134
|
+
"license": "MIT",
|
|
135
|
+
"abiVersion": 14,
|
|
136
|
+
"asset": "tree-sitter-java.wasm",
|
|
137
|
+
"sha256": "4fdeac4ca6ca089f06c6f7e562abcac1733cd465728cc7031ebb73c2019122c4"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"language": "json",
|
|
141
|
+
"package": "tree-sitter-json",
|
|
142
|
+
"version": "0.24.8",
|
|
143
|
+
"sourceCommit": "ee35a6ebefcef0c5c416c0d1ccec7370cfca5a24",
|
|
144
|
+
"license": "MIT",
|
|
145
|
+
"abiVersion": 14,
|
|
146
|
+
"asset": "tree-sitter-json.wasm",
|
|
147
|
+
"sha256": "d2119fb98d5912719b13f9458574f8608d2d29dfbe45f6be1f860ea1fe2a2405"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"language": "julia",
|
|
151
|
+
"package": "tree-sitter-julia",
|
|
152
|
+
"version": "0.23.1",
|
|
153
|
+
"sourceCommit": "a8e1262997d5a45520a06cbe1b86c0737d507054",
|
|
154
|
+
"license": "MIT",
|
|
155
|
+
"abiVersion": 14,
|
|
156
|
+
"asset": "tree-sitter-julia.wasm",
|
|
157
|
+
"sha256": "e0f52c36eadf0299e46fccd6715c760d35eaa3f09721bec38633da551ac9e781"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"language": "ocaml",
|
|
161
|
+
"package": "tree-sitter-ocaml",
|
|
162
|
+
"version": "0.24.2",
|
|
163
|
+
"sourceCommit": "0cc270ff90ca09c29d0f2f9dec69ddfef55a3eff",
|
|
164
|
+
"license": "MIT",
|
|
165
|
+
"abiVersion": 14,
|
|
166
|
+
"asset": "tree-sitter-ocaml.wasm",
|
|
167
|
+
"sha256": "761a78a804931cfac1fa0c6238989b4b0e86cc70db461b1315d743de923f8246"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"language": "ocaml_interface",
|
|
171
|
+
"package": "tree-sitter-ocaml",
|
|
172
|
+
"version": "0.24.2",
|
|
173
|
+
"sourceCommit": "0cc270ff90ca09c29d0f2f9dec69ddfef55a3eff",
|
|
174
|
+
"license": "MIT",
|
|
175
|
+
"abiVersion": 14,
|
|
176
|
+
"asset": "tree-sitter-ocaml_interface.wasm",
|
|
177
|
+
"sha256": "c065e8da9052899592bd68c820ffda076e23394129de14c0bd2c46b189415ea9"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"language": "python",
|
|
181
|
+
"package": "tree-sitter-python",
|
|
182
|
+
"version": "0.25.0",
|
|
183
|
+
"sourceCommit": "293fdc02038ee2bf0e2e206711b69c90ac0d413f",
|
|
184
|
+
"license": "MIT",
|
|
185
|
+
"abiVersion": 15,
|
|
186
|
+
"asset": "tree-sitter-python.wasm",
|
|
187
|
+
"sha256": "16108b50df4ee9a30168794252ab55e7c93bfc5765d7fa0aa3e335752c515f47"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"language": "ql_dbscheme",
|
|
191
|
+
"package": "tree-sitter-ql-dbscheme",
|
|
192
|
+
"version": "0.23.1",
|
|
193
|
+
"sourceCommit": "15baf01feb5f20bb3d668d27abc0a36e944b183f",
|
|
194
|
+
"license": "MIT",
|
|
195
|
+
"abiVersion": 14,
|
|
196
|
+
"asset": "tree-sitter-ql_dbscheme.wasm",
|
|
197
|
+
"sha256": "c3e3c839c45eca3def8aed27c5205ec1fceed80d2b85a7d65f23747549ba0355"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"language": "ruby",
|
|
201
|
+
"package": "tree-sitter-ruby",
|
|
202
|
+
"version": "0.23.1",
|
|
203
|
+
"sourceCommit": "71bd32fb7607035768799732addba884a37a6210",
|
|
204
|
+
"license": "MIT",
|
|
205
|
+
"abiVersion": 14,
|
|
206
|
+
"asset": "tree-sitter-ruby.wasm",
|
|
207
|
+
"sha256": "09a96427d7c72f0613ed470cd9812223fc4a91d6a9c025c0235cc6bd59ff96f4"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"language": "rust",
|
|
211
|
+
"package": "tree-sitter-rust",
|
|
212
|
+
"version": "0.24.0",
|
|
213
|
+
"sourceCommit": "18b0515fca567f5a10aee9978c6d2640e878671a",
|
|
214
|
+
"license": "MIT",
|
|
215
|
+
"abiVersion": 14,
|
|
216
|
+
"asset": "tree-sitter-rust.wasm",
|
|
217
|
+
"sha256": "f65f354215611fd94ad34134b3427eb3d58cbb745df7b6509ba722184db73d57"
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"language": "scala",
|
|
221
|
+
"package": "tree-sitter-scala",
|
|
222
|
+
"version": "0.24.0",
|
|
223
|
+
"sourceCommit": "2d55e74b0485fe05058ffe5e8155506c9710c767",
|
|
224
|
+
"license": "MIT",
|
|
225
|
+
"abiVersion": 14,
|
|
226
|
+
"asset": "tree-sitter-scala.wasm",
|
|
227
|
+
"sha256": "b7ec2bb29c19827abcefd18ed5cb5a43596009f96a5d53c5b9d1f9676d7521c3"
|
|
48
228
|
}
|
|
49
229
|
]
|
|
50
230
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/lib/parser-worker.mjs
CHANGED
|
@@ -8,6 +8,24 @@ const assets = {
|
|
|
8
8
|
typescript: 'tree-sitter-typescript.wasm',
|
|
9
9
|
tsx: 'tree-sitter-tsx.wasm',
|
|
10
10
|
php: 'tree-sitter-php.wasm',
|
|
11
|
+
bash: 'tree-sitter-bash.wasm',
|
|
12
|
+
c: 'tree-sitter-c.wasm',
|
|
13
|
+
cpp: 'tree-sitter-cpp.wasm',
|
|
14
|
+
c_sharp: 'tree-sitter-c_sharp.wasm',
|
|
15
|
+
css: 'tree-sitter-css.wasm',
|
|
16
|
+
go: 'tree-sitter-go.wasm',
|
|
17
|
+
haskell: 'tree-sitter-haskell.wasm',
|
|
18
|
+
html: 'tree-sitter-html.wasm',
|
|
19
|
+
java: 'tree-sitter-java.wasm',
|
|
20
|
+
json: 'tree-sitter-json.wasm',
|
|
21
|
+
julia: 'tree-sitter-julia.wasm',
|
|
22
|
+
ocaml: 'tree-sitter-ocaml.wasm',
|
|
23
|
+
ocaml_interface: 'tree-sitter-ocaml_interface.wasm',
|
|
24
|
+
python: 'tree-sitter-python.wasm',
|
|
25
|
+
ql_dbscheme: 'tree-sitter-ql_dbscheme.wasm',
|
|
26
|
+
ruby: 'tree-sitter-ruby.wasm',
|
|
27
|
+
rust: 'tree-sitter-rust.wasm',
|
|
28
|
+
scala: 'tree-sitter-scala.wasm',
|
|
11
29
|
}
|
|
12
30
|
const MAX_CACHE_ENTRIES = 16
|
|
13
31
|
const MAX_CACHE_BYTES = 16 * 1024 * 1024
|
package/lib/provider.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { WebstackLspError } from "./errors-DtyWAUi0.js";
|
|
2
2
|
import { SERVER_IDS, createWebstackLspService, initializationOptions, resolveConfig, resolveLaunch, serverConfiguration } from "./launch-ByUvgkVv.js";
|
|
3
3
|
import { mergeCompletions, mergeDiagnostics } from "./completion-B7NPVCEN.js";
|
|
4
|
-
import { DocumentSnapshotStore, createCodeIntelligenceToolServiceV1 } from "./code-intelligence-
|
|
4
|
+
import { DocumentSnapshotStore, createCodeIntelligenceToolServiceV1 } from "./code-intelligence-BbjV-vXG.js";
|
|
5
5
|
import { LspProviderId } from "@deepseek-ai/dsh-lsp";
|
|
6
6
|
import { isAbsolute } from "node:path";
|
|
7
7
|
import { TextDecoder } from "node:util";
|
|
@@ -287,6 +287,70 @@ function hasTailwindCandidate(source, line, classRegex = [], character, classAtt
|
|
|
287
287
|
return [...DEFAULT_PATTERNS, ...configured].some((pattern) => pattern.test(context));
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
+
//#endregion
|
|
291
|
+
//#region src/servers/typescript-diagnostics.ts
|
|
292
|
+
const command = "typescript.tsserverRequest";
|
|
293
|
+
const diagnosticCommands = [
|
|
294
|
+
"syntacticDiagnosticsSync",
|
|
295
|
+
"semanticDiagnosticsSync",
|
|
296
|
+
"suggestionDiagnosticsSync"
|
|
297
|
+
];
|
|
298
|
+
const severities = {
|
|
299
|
+
error: 1,
|
|
300
|
+
warning: 2,
|
|
301
|
+
message: 3,
|
|
302
|
+
suggestion: 4
|
|
303
|
+
};
|
|
304
|
+
function supportsTypeScriptDiagnostics(capabilities) {
|
|
305
|
+
const provider = capabilities.executeCommandProvider;
|
|
306
|
+
return isRecord$6(provider) && Array.isArray(provider.commands) && provider.commands.includes(command);
|
|
307
|
+
}
|
|
308
|
+
async function requestTypeScriptDiagnostics(connection, uri, signal) {
|
|
309
|
+
const diagnostics = [];
|
|
310
|
+
for (const diagnosticCommand of diagnosticCommands) {
|
|
311
|
+
const response = await connection.request("workspace/executeCommand", {
|
|
312
|
+
command,
|
|
313
|
+
arguments: [
|
|
314
|
+
diagnosticCommand,
|
|
315
|
+
{ file: uri },
|
|
316
|
+
{
|
|
317
|
+
executionTarget: 0,
|
|
318
|
+
expectsResult: true
|
|
319
|
+
}
|
|
320
|
+
]
|
|
321
|
+
}, signal);
|
|
322
|
+
if (!isRecord$6(response) || response.type !== "response" || response.success !== true || !Array.isArray(response.body)) throw malformedResponse();
|
|
323
|
+
for (const item of response.body) diagnostics.push(toDiagnostic(item));
|
|
324
|
+
}
|
|
325
|
+
return diagnostics;
|
|
326
|
+
}
|
|
327
|
+
function toDiagnostic(value) {
|
|
328
|
+
if (!isRecord$6(value) || typeof value.text !== "string" || typeof value.category !== "string" || !Object.hasOwn(severities, value.category) || !Number.isSafeInteger(value.code)) throw malformedResponse();
|
|
329
|
+
return {
|
|
330
|
+
range: {
|
|
331
|
+
start: toPosition(value.start),
|
|
332
|
+
end: toPosition(value.end)
|
|
333
|
+
},
|
|
334
|
+
message: value.text,
|
|
335
|
+
severity: severities[value.category],
|
|
336
|
+
code: value.code,
|
|
337
|
+
source: typeof value.source === "string" ? value.source : "ts"
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
function toPosition(value) {
|
|
341
|
+
if (!isRecord$6(value) || typeof value.line !== "number" || typeof value.offset !== "number" || !Number.isSafeInteger(value.line) || !Number.isSafeInteger(value.offset) || value.line < 1 || value.offset < 1) throw malformedResponse();
|
|
342
|
+
return {
|
|
343
|
+
line: value.line - 1,
|
|
344
|
+
character: value.offset - 1
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
function isRecord$6(value) {
|
|
348
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
349
|
+
}
|
|
350
|
+
function malformedResponse() {
|
|
351
|
+
return new WebstackLspError("LSP_MALFORMED_RESPONSE", "TypeScript server returned an invalid diagnostic response");
|
|
352
|
+
}
|
|
353
|
+
|
|
290
354
|
//#endregion
|
|
291
355
|
//#region src/protocol/initialize.ts
|
|
292
356
|
async function initializeServer(connection, params, signal) {
|
|
@@ -1493,6 +1557,10 @@ var WebstackLspRuntime = class {
|
|
|
1493
1557
|
await opened();
|
|
1494
1558
|
return (await connection.request("textDocument/diagnostic", { textDocument: { uri: source.uri } }, deadline))?.items ?? [];
|
|
1495
1559
|
}
|
|
1560
|
+
if (item.server === "typescript" && supportsTypeScriptDiagnostics(session.capabilities)) {
|
|
1561
|
+
await opened();
|
|
1562
|
+
return requestTypeScriptDiagnostics(connection, source.uri, deadline);
|
|
1563
|
+
}
|
|
1496
1564
|
let remove = () => {};
|
|
1497
1565
|
const published = new Promise((resolve$1) => {
|
|
1498
1566
|
remove = connection.onNotification((message) => {
|
|
@@ -1717,7 +1785,7 @@ var WebstackLspRuntime = class {
|
|
|
1717
1785
|
if (opened && connection.isOpen) await connection.notify("textDocument/didClose", { textDocument: { uri: source.uri } }).catch(() => {});
|
|
1718
1786
|
}
|
|
1719
1787
|
}, signal), signal, manualOpen ? (session) => {
|
|
1720
|
-
return !!session.capabilities.diagnosticProvider;
|
|
1788
|
+
return !!session.capabilities.diagnosticProvider || id === "typescript" && supportsTypeScriptDiagnostics(session.capabilities);
|
|
1721
1789
|
} : void 0);
|
|
1722
1790
|
}
|
|
1723
1791
|
};
|