Skip to content

Commit a149311

Browse files
committed
fix lint
1 parent b0172c8 commit a149311

10 files changed

+481
-434
lines changed

.claude/settings.local.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ node_modules
44
*.vsix
55
**/erl_crash.dump
66
elixir-ls-release/
7+
8+
.claude
9+
CLAUDE.local.md
10+
.mcp.json

src/commands/runTest.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,8 @@ function getExistingLaunchConfig(
3232
"launch",
3333
args.workspaceFolder,
3434
);
35-
const configurations = launchJson.get<vscode.DebugConfiguration[]>(
36-
"configurations",
37-
);
35+
const configurations =
36+
launchJson.get<vscode.DebugConfiguration[]>("configurations");
3837
let testConfig: vscode.DebugConfiguration | undefined;
3938
if (Array.isArray(configurations)) {
4039
for (let i = configurations.length - 1; i >= 0; i--) {

src/definition-tool.ts

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import * as vscode from "vscode";
22
import {
3-
ExecuteCommandParams,
3+
type ExecuteCommandParams,
44
ExecuteCommandRequest,
5-
LanguageClient,
5+
type LanguageClient,
66
} from "vscode-languageclient/node";
77

88
interface IParameters {
@@ -19,7 +19,7 @@ export class DefinitionTool implements vscode.LanguageModelTool<IParameters> {
1919

2020
async prepareInvocation(
2121
options: vscode.LanguageModelToolInvocationPrepareOptions<IParameters>,
22-
_token: vscode.CancellationToken
22+
_token: vscode.CancellationToken,
2323
): Promise<vscode.PreparedToolInvocation> {
2424
return {
2525
invocationMessage: `Looking up definition for: ${options.input.symbol}`,
@@ -28,21 +28,21 @@ export class DefinitionTool implements vscode.LanguageModelTool<IParameters> {
2828

2929
async invoke(
3030
options: vscode.LanguageModelToolInvocationOptions<IParameters>,
31-
token: vscode.CancellationToken
31+
token: vscode.CancellationToken,
3232
): Promise<vscode.LanguageModelToolResult> {
3333
const { symbol } = options.input;
3434

3535
try {
3636
// Find the llmDefinition command from server capabilities
37-
const command = this.client.initializeResult?.capabilities
38-
.executeCommandProvider?.commands.find((c) =>
39-
c.startsWith("llmDefinition:")
37+
const command =
38+
this.client.initializeResult?.capabilities.executeCommandProvider?.commands.find(
39+
(c) => c.startsWith("llmDefinition:"),
4040
);
4141

4242
if (!command) {
4343
return new vscode.LanguageModelToolResult([
4444
new vscode.LanguageModelTextPart(
45-
"ElixirLS language server is not ready or does not support the llmDefinition command"
45+
"ElixirLS language server is not ready or does not support the llmDefinition command",
4646
),
4747
]);
4848
}
@@ -55,13 +55,13 @@ export class DefinitionTool implements vscode.LanguageModelTool<IParameters> {
5555
const result = await this.client.sendRequest<IDefinitionResult>(
5656
ExecuteCommandRequest.method,
5757
params,
58-
token
58+
token,
5959
);
6060

6161
if (result?.error) {
6262
return new vscode.LanguageModelToolResult([
6363
new vscode.LanguageModelTextPart(
64-
`Error finding definition: ${result.error}`
64+
`Error finding definition: ${result.error}`,
6565
),
6666
]);
6767
}
@@ -74,16 +74,17 @@ export class DefinitionTool implements vscode.LanguageModelTool<IParameters> {
7474

7575
return new vscode.LanguageModelToolResult([
7676
new vscode.LanguageModelTextPart(
77-
`No definition found for symbol: ${symbol}`
77+
`No definition found for symbol: ${symbol}`,
7878
),
7979
]);
8080
} catch (error) {
81-
const errorMessage = error instanceof Error ? error.message : String(error);
81+
const errorMessage =
82+
error instanceof Error ? error.message : String(error);
8283
return new vscode.LanguageModelToolResult([
8384
new vscode.LanguageModelTextPart(
84-
`Failed to look up definition: ${errorMessage}`
85+
`Failed to look up definition: ${errorMessage}`,
8586
),
8687
]);
8788
}
8889
}
89-
}
90+
}

src/docs-aggregator-tool.ts

Lines changed: 73 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
import * as vscode from "vscode";
22
import {
3-
ExecuteCommandParams,
3+
type ExecuteCommandParams,
44
ExecuteCommandRequest,
5-
LanguageClient,
5+
type LanguageClient,
66
} from "vscode-languageclient/node";
77

88
interface IParameters {
99
modules: string[];
1010
}
1111

12-
export class DocsAggregatorTool implements vscode.LanguageModelTool<IParameters> {
12+
export class DocsAggregatorTool
13+
implements vscode.LanguageModelTool<IParameters>
14+
{
1315
constructor(private client: LanguageClient) {}
1416

1517
async prepareInvocation(
1618
options: vscode.LanguageModelToolInvocationPrepareOptions<IParameters>,
17-
_token: vscode.CancellationToken
19+
_token: vscode.CancellationToken,
1820
): Promise<vscode.PreparedToolInvocation> {
1921
return {
2022
invocationMessage: `Getting documentation for: ${options.input.modules.join(", ")}`,
@@ -23,21 +25,21 @@ export class DocsAggregatorTool implements vscode.LanguageModelTool<IParameters>
2325

2426
async invoke(
2527
options: vscode.LanguageModelToolInvocationOptions<IParameters>,
26-
token: vscode.CancellationToken
28+
token: vscode.CancellationToken,
2729
): Promise<vscode.LanguageModelToolResult> {
2830
const { modules } = options.input;
2931

3032
try {
3133
// Find the llmDocsAggregator command from server capabilities
32-
const command = this.client.initializeResult?.capabilities
33-
.executeCommandProvider?.commands.find((c) =>
34-
c.startsWith("llmDocsAggregator:")
34+
const command =
35+
this.client.initializeResult?.capabilities.executeCommandProvider?.commands.find(
36+
(c) => c.startsWith("llmDocsAggregator:"),
3537
);
3638

3739
if (!command) {
3840
return new vscode.LanguageModelToolResult([
3941
new vscode.LanguageModelTextPart(
40-
"ElixirLS language server is not ready or does not support the llmDocsAggregator command"
42+
"ElixirLS language server is not ready or does not support the llmDocsAggregator command",
4143
),
4244
]);
4345
}
@@ -58,158 +60,166 @@ export class DocsAggregatorTool implements vscode.LanguageModelTool<IParameters>
5860
callbacks?: string[];
5961
macrocallbacks?: string[];
6062
behaviours?: string[];
61-
63+
6264
// Function/callback/type documentation fields
6365
function?: string;
6466
callback?: string;
6567
type?: string;
6668
arity?: number;
6769
documentation?: string;
68-
70+
6971
// Attribute documentation fields
7072
attribute?: string;
71-
73+
7274
// Error field
7375
error?: string;
7476
}>;
7577
error?: string;
76-
}>(
77-
ExecuteCommandRequest.method,
78-
params,
79-
token
80-
);
78+
}>(ExecuteCommandRequest.method, params, token);
8179

8280
if (result?.error) {
8381
return new vscode.LanguageModelToolResult([
8482
new vscode.LanguageModelTextPart(
85-
`Error getting documentation: ${result.error}`
83+
`Error getting documentation: ${result.error}`,
8684
),
8785
]);
8886
}
8987

9088
if (result?.results) {
9189
const parts: vscode.LanguageModelTextPart[] = [];
92-
90+
9391
for (const item of result.results) {
9492
if (item.error) {
95-
const name = item.module || item.function || item.callback || item.type || item.attribute || "Unknown";
93+
const name =
94+
item.module ||
95+
item.function ||
96+
item.callback ||
97+
item.type ||
98+
item.attribute ||
99+
"Unknown";
96100
parts.push(
97101
new vscode.LanguageModelTextPart(
98-
`## ${name}\nError: ${item.error}\n\n`
99-
)
102+
`## ${name}\nError: ${item.error}\n\n`,
103+
),
100104
);
101105
} else if (item.module && item.moduledoc !== undefined) {
102106
// Module documentation
103107
parts.push(
104-
new vscode.LanguageModelTextPart(
105-
`# Module: ${item.module}\n\n`
106-
)
108+
new vscode.LanguageModelTextPart(`# Module: ${item.module}\n\n`),
107109
);
108-
110+
109111
if (item.moduledoc) {
110112
parts.push(
111-
new vscode.LanguageModelTextPart(
112-
`${item.moduledoc}\n\n`
113-
)
113+
new vscode.LanguageModelTextPart(`${item.moduledoc}\n\n`),
114114
);
115115
}
116-
116+
117117
if (item.functions && item.functions.length > 0) {
118118
parts.push(
119119
new vscode.LanguageModelTextPart(
120-
`## Functions\n${item.functions.join(", ")}\n\n`
121-
)
120+
`## Functions\n${item.functions.join(", ")}\n\n`,
121+
),
122122
);
123123
}
124-
124+
125125
if (item.macros && item.macros.length > 0) {
126126
parts.push(
127127
new vscode.LanguageModelTextPart(
128-
`## Macros\n${item.macros.join(", ")}\n\n`
129-
)
128+
`## Macros\n${item.macros.join(", ")}\n\n`,
129+
),
130130
);
131131
}
132-
132+
133133
if (item.types && item.types.length > 0) {
134134
parts.push(
135135
new vscode.LanguageModelTextPart(
136-
`## Types\n${item.types.join(", ")}\n\n`
137-
)
136+
`## Types\n${item.types.join(", ")}\n\n`,
137+
),
138138
);
139139
}
140-
140+
141141
if (item.callbacks && item.callbacks.length > 0) {
142142
parts.push(
143143
new vscode.LanguageModelTextPart(
144-
`## Callbacks\n${item.callbacks.join(", ")}\n\n`
145-
)
144+
`## Callbacks\n${item.callbacks.join(", ")}\n\n`,
145+
),
146146
);
147147
}
148-
148+
149149
if (item.macrocallbacks && item.macrocallbacks.length > 0) {
150150
parts.push(
151151
new vscode.LanguageModelTextPart(
152-
`## Macro Callbacks\n${item.macrocallbacks.join(", ")}\n\n`
153-
)
152+
`## Macro Callbacks\n${item.macrocallbacks.join(", ")}\n\n`,
153+
),
154154
);
155155
}
156-
156+
157157
if (item.behaviours && item.behaviours.length > 0) {
158158
parts.push(
159159
new vscode.LanguageModelTextPart(
160-
`## Behaviours\n${item.behaviours.join(", ")}\n\n`
161-
)
160+
`## Behaviours\n${item.behaviours.join(", ")}\n\n`,
161+
),
162162
);
163163
}
164164
} else if (item.function) {
165165
// Function documentation
166-
const title = item.arity !== undefined ? `${item.function}/${item.arity}` : item.function;
166+
const title =
167+
item.arity !== undefined
168+
? `${item.function}/${item.arity}`
169+
: item.function;
167170
parts.push(
168171
new vscode.LanguageModelTextPart(
169-
`# Function: ${item.module}.${title}\n\n${item.documentation || "No documentation available"}\n\n`
170-
)
172+
`# Function: ${item.module}.${title}\n\n${item.documentation || "No documentation available"}\n\n`,
173+
),
171174
);
172175
} else if (item.callback) {
173176
// Callback documentation
174-
const title = item.arity !== undefined ? `${item.callback}/${item.arity}` : item.callback;
177+
const title =
178+
item.arity !== undefined
179+
? `${item.callback}/${item.arity}`
180+
: item.callback;
175181
parts.push(
176182
new vscode.LanguageModelTextPart(
177-
`# Callback: ${item.module}.${title}\n\n${item.documentation || "No documentation available"}\n\n`
178-
)
183+
`# Callback: ${item.module}.${title}\n\n${item.documentation || "No documentation available"}\n\n`,
184+
),
179185
);
180186
} else if (item.type) {
181187
// Type documentation
182-
const title = item.arity !== undefined ? `${item.type}/${item.arity}` : item.type;
188+
const title =
189+
item.arity !== undefined
190+
? `${item.type}/${item.arity}`
191+
: item.type;
183192
parts.push(
184193
new vscode.LanguageModelTextPart(
185-
`# Type: ${item.module}.${title}\n\n${item.documentation || "No documentation available"}\n\n`
186-
)
194+
`# Type: ${item.module}.${title}\n\n${item.documentation || "No documentation available"}\n\n`,
195+
),
187196
);
188197
} else if (item.attribute) {
189198
// Attribute documentation
190199
parts.push(
191200
new vscode.LanguageModelTextPart(
192-
`# Attribute: ${item.attribute}\n\n${item.documentation || "No documentation available"}\n\n`
193-
)
201+
`# Attribute: ${item.attribute}\n\n${item.documentation || "No documentation available"}\n\n`,
202+
),
194203
);
195204
}
196205
}
197-
206+
198207
return new vscode.LanguageModelToolResult(parts);
199208
}
200209

201210
return new vscode.LanguageModelToolResult([
202211
new vscode.LanguageModelTextPart(
203-
`No documentation found for: ${modules.join(", ")}`
212+
`No documentation found for: ${modules.join(", ")}`,
204213
),
205214
]);
206215
} catch (error) {
207-
const errorMessage = error instanceof Error ? error.message : String(error);
216+
const errorMessage =
217+
error instanceof Error ? error.message : String(error);
208218
return new vscode.LanguageModelToolResult([
209219
new vscode.LanguageModelTextPart(
210-
`Failed to get documentation: ${errorMessage}`
220+
`Failed to get documentation: ${errorMessage}`,
211221
),
212222
]);
213223
}
214224
}
215-
}
225+
}

0 commit comments

Comments
 (0)