Skip to content

Commit c7b6dd2

Browse files
authored
Remove explanation placeholders (#478)
* docs: replace explanation placeholders * chore: sort imports for biome
1 parent f656434 commit c7b6dd2

File tree

15 files changed

+43
-43
lines changed

15 files changed

+43
-43
lines changed

src/commands/expandMacro.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export function configureExpandMacro(
7575
}
7676

7777
const command =
78-
// biome-ignore lint/style/noNonNullAssertion: <explanation>
78+
// biome-ignore lint/style/noNonNullAssertion: server capabilities guarantee this command exists
7979
client.initializeResult.capabilities.executeCommandProvider?.commands.find(
8080
(c) => c.startsWith("expandMacro:"),
8181
)!;

src/commands/manipulatePipes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export function configureManipulatePipes(
4343
}
4444

4545
const command =
46-
// biome-ignore lint/style/noNonNullAssertion: <explanation>
46+
// biome-ignore lint/style/noNonNullAssertion: server capabilities guarantee this command exists
4747
client.initializeResult.capabilities.executeCommandProvider?.commands.find(
4848
(c: string) => c.startsWith("manipulatePipes:"),
4949
)!;

src/commands/mixClean.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export function configureMixClean(
3535
return;
3636
}
3737
const command =
38-
// biome-ignore lint/style/noNonNullAssertion: <explanation>
38+
// biome-ignore lint/style/noNonNullAssertion: server capabilities guarantee this command exists
3939
client.initializeResult.capabilities.executeCommandProvider?.commands.find(
4040
(c) => c.startsWith("mixClean:"),
4141
)!;

src/debugAdapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ class DebugAdapterTrackerFactory
201201

202202
if (event.event === "initialized") {
203203
const elapsed =
204-
// biome-ignore lint/style/noNonNullAssertion: <explanation>
204+
// biome-ignore lint/style/noNonNullAssertion: start time exists for active sessions
205205
performance.now() - this.startTimes.get(session.id)!;
206206
reporter.sendTelemetryEvent(
207207
"debug_session_initialized",

src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const languageClientManager = new LanguageClientManager(
2424
);
2525

2626
const startClientsForOpenDocuments = (context: vscode.ExtensionContext) => {
27-
// biome-ignore lint/complexity/noForEach: <explanation>
27+
// biome-ignore lint/complexity/noForEach: iterating with forEach keeps the initialization straightforward
2828
vscode.workspace.textDocuments.forEach((value) => {
2929
languageClientManager.handleDidOpenTextDocument(value, context);
3030
});

src/languageClientManager.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as vscode from "vscode";
22
import {
33
type Disposable,
4+
type DocumentSelector,
45
type Executable,
56
LanguageClient,
67
type LanguageClientOptions,
@@ -69,8 +70,7 @@ function startClient(
6970
debug: serverOpts,
7071
};
7172

72-
// biome-ignore lint/suspicious/noImplicitAnyLet: <explanation>
73-
let displayName;
73+
let displayName: string;
7474
if (clientOptions.workspaceFolder) {
7575
console.log(
7676
`ElixirLS: starting LSP client for ${clientOptions.workspaceFolder.uri.fsPath} with server options`,
@@ -320,15 +320,15 @@ export class LanguageClientManager {
320320
folder = vscode.workspace.workspaceFolders[0];
321321
} else {
322322
// no folders - use default client
323-
// biome-ignore lint/style/noNonNullAssertion: <explanation>
323+
// biome-ignore lint/style/noNonNullAssertion: a default client is always started when no workspace folders exist
324324
return this.defaultClientPromise!;
325325
}
326326
}
327327

328328
// If we have nested workspace folders we only start a server on the outer most workspace folder.
329329
folder = this._workspaceTracker.getOuterMostWorkspaceFolder(folder);
330330

331-
// biome-ignore lint/style/noNonNullAssertion: <explanation>
331+
// biome-ignore lint/style/noNonNullAssertion: the client promise is set when the workspace folder's client is started
332332
return this.clientsPromises.get(folder.uri.toString())!;
333333
}
334334

@@ -399,8 +399,8 @@ export class LanguageClientManager {
399399
folder = this._workspaceTracker.getOuterMostWorkspaceFolder(folder);
400400

401401
if (!this.clients.has(folder.uri.toString())) {
402-
// biome-ignore lint/suspicious/noImplicitAnyLet: <explanation>
403-
let documentSelector;
402+
// The document selector will be assigned based on workspace mode
403+
let documentSelector: DocumentSelector = defaultDocumentSelector;
404404
if (this._workspaceTracker.mode === WorkspaceMode.MULTI_ROOT) {
405405
// multi-root workspace
406406
// create document selector with glob pattern that will match files
@@ -450,9 +450,9 @@ export class LanguageClientManager {
450450
const clientsToDispose: LanguageClient[] = [];
451451
let changed = false;
452452
if (this.defaultClient) {
453-
// biome-ignore lint/complexity/noForEach: <explanation>
453+
// biome-ignore lint/complexity/noForEach: disposing all registered disposables is easier with forEach
454454
this.defaultClientDisposables?.forEach((d) => d.dispose());
455-
// biome-ignore lint/style/noNonNullAssertion: <explanation>
455+
// biome-ignore lint/style/noNonNullAssertion: defaultClientPromise is defined whenever defaultClient is
456456
clientStartPromises.push(this.defaultClientPromise!);
457457
clientsToDispose.push(this.defaultClient);
458458
this.defaultClient = null;
@@ -462,9 +462,9 @@ export class LanguageClientManager {
462462
}
463463

464464
for (const [uri, client] of this.clients.entries()) {
465-
// biome-ignore lint/complexity/noForEach: <explanation>
465+
// biome-ignore lint/complexity/noForEach: disposing all registered disposables is easier with forEach
466466
this.clientsDisposables.get(uri)?.forEach((d) => d.dispose());
467-
// biome-ignore lint/style/noNonNullAssertion: <explanation>
467+
// biome-ignore lint/style/noNonNullAssertion: a promise exists for every started client
468468
clientStartPromises.push(this.clientsPromises.get(uri)!);
469469
clientsToDispose.push(client);
470470
changed = true;
@@ -498,9 +498,9 @@ export class LanguageClientManager {
498498
const client = this.clients.get(uri);
499499
if (client) {
500500
console.log("ElixirLS: Stopping LSP client for", folder.uri.fsPath);
501-
// biome-ignore lint/complexity/noForEach: <explanation>
501+
// biome-ignore lint/complexity/noForEach: disposing all registered disposables is easier with forEach
502502
this.clientsDisposables.get(uri)?.forEach((d) => d.dispose());
503-
// biome-ignore lint/style/noNonNullAssertion: <explanation>
503+
// biome-ignore lint/style/noNonNullAssertion: a promise exists for every started client
504504
const clientPromise = this.clientsPromises.get(uri)!;
505505

506506
this.clients.delete(uri);
@@ -520,7 +520,7 @@ export class LanguageClientManager {
520520
);
521521
reporter.sendTelemetryErrorEvent("language_client_stop_error", {
522522
"elixir_ls.language_client_stop_error": String(e),
523-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
523+
// biome-ignore lint/suspicious/noExplicitAny: error may not be typed, cast to access stack trace
524524
"elixir_ls.language_client_start_error_stack": (<any>e)?.stack ?? "",
525525
});
526526
}
@@ -531,7 +531,7 @@ export class LanguageClientManager {
531531
console.warn("ElixirLS: error during LSP client dispose", e);
532532
reporter.sendTelemetryErrorEvent("language_client_stop_error", {
533533
"elixir_ls.language_client_stop_error": String(e),
534-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
534+
// biome-ignore lint/suspicious/noExplicitAny: error may not be typed, cast to access stack trace
535535
"elixir_ls.language_client_start_error_stack": (<any>e)?.stack ?? "",
536536
});
537537
}

src/telemetry.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -284,21 +284,21 @@ class EnvironmentReporter extends TelemetryReporter {
284284
const label = `elixir_ls.${eventName}_count`;
285285
if (!measurements) {
286286
const measurementsWithCount: TelemetryEventMeasurements = {};
287-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
287+
// biome-ignore lint/suspicious/noExplicitAny: dynamic property access requires an explicit any cast
288288
(<any>measurementsWithCount)[label] = 1 / samplingFactor;
289289
return measurementsWithCount;
290290
}
291291
let countFound = false;
292-
// biome-ignore lint/complexity/noForEach: <explanation>
292+
// biome-ignore lint/complexity/noForEach: forEach provides a concise way to modify the object in place
293293
Object.keys(measurements).forEach((key) => {
294294
if (key.endsWith("_count")) {
295-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
295+
// biome-ignore lint/suspicious/noExplicitAny: dynamic property access requires an explicit any cast
296296
(<any>measurements)[key] /= samplingFactor;
297297
countFound = true;
298298
}
299299
});
300300
if (!countFound) {
301-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
301+
// biome-ignore lint/suspicious/noExplicitAny: dynamic property access requires an explicit any cast
302302
(<any>measurements)[label] = 1 / samplingFactor;
303303
}
304304
return measurements;
@@ -373,7 +373,7 @@ export function preprocessStacktrace(originalStack: string) {
373373
"pwd",
374374
"android:value",
375375
];
376-
// biome-ignore lint/complexity/noForEach: <explanation>
376+
// biome-ignore lint/complexity/noForEach: forEach simplifies keyword replacement logic
377377
sensitiveKeywords.forEach((keyword) => {
378378
const regex = new RegExp(`(${keyword})[^a-zA-Z0-9]`, "gi");
379379
const encodeKeyword = `${keyword[0]}_${keyword.slice(1)}`;
@@ -393,9 +393,9 @@ export function preprocessStacktraceInProperties(
393393
return properties;
394394
}
395395

396-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
396+
// biome-ignore lint/suspicious/noExplicitAny: properties may contain arbitrary values
397397
for (const key in <any>properties) {
398-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
398+
// biome-ignore lint/suspicious/noExplicitAny: values may be of unknown type
399399
(<any>properties)[key] = preprocessStacktrace((<any>properties)[key]);
400400
}
401401
return properties;

src/terminalLinkProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export function configureTerminalLinkProvider(
3535

3636
return [
3737
{
38-
// biome-ignore lint/style/noNonNullAssertion: <explanation>
38+
// biome-ignore lint/style/noNonNullAssertion: matches is defined because we return early when the regex does not match
3939
startIndex: matches.index!,
4040
length: matches[0].length,
4141
data: {

src/test/multiRoot/extension.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ suite("Multi root workspace tests", () => {
152152
assert.equal(extension.exports.languageClientManager.clients.size, 3);
153153

154154
const addedWorkspaceFolder =
155-
// biome-ignore lint/style/noNonNullAssertion: <explanation>
155+
// biome-ignore lint/style/noNonNullAssertion: the workspace folder exists because it was added above
156156
vscode.workspace.getWorkspaceFolder(addedFolderUri)!;
157157

158158
await waitForLanguageClientManagerUpdate(extension, async () => {
@@ -189,7 +189,7 @@ suite("Multi root workspace tests", () => {
189189
assert.equal(extension.exports.languageClientManager.clients.size, 2);
190190

191191
const addedWorkspaceFolder =
192-
// biome-ignore lint/style/noNonNullAssertion: <explanation>
192+
// biome-ignore lint/style/noNonNullAssertion: the workspace folder exists because it was added above
193193
vscode.workspace.getWorkspaceFolder(addedFolderUri)!;
194194

195195
await waitForWorkspaceUpdate(() => {

src/test/multiRoot/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export async function run(
1515
try {
1616
const files = await glob("**/**.test.js", { cwd: testsRoot });
1717
// Add files to the test suite
18-
// biome-ignore lint/complexity/noForEach: <explanation>
18+
// biome-ignore lint/complexity/noForEach: using forEach keeps the setup concise when adding test files
1919
files.forEach((f) => mocha.addFile(path.resolve(testsRoot, f)));
2020

2121
try {

0 commit comments

Comments
 (0)