Skip to content

Commit 3d509f7

Browse files
committed
Modernize
- Remove obsolete dependencies. - abort-controller; `AbortController` is stable since Node 15.4.0. - Update dependencies. - @clangd/install; required as `AbortController` is part of the API surface so be the same type. Fixes #560.
1 parent 86af18e commit 3d509f7

File tree

12 files changed

+5505
-2666
lines changed

12 files changed

+5505
-2666
lines changed

package-lock.json

Lines changed: 5456 additions & 2611 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"homepage": "https://clangd.llvm.org/",
99
"icon": "icon.png",
1010
"engines": {
11-
"vscode": "^1.65.0"
11+
"vscode": "^1.75.0"
1212
},
1313
"categories": [
1414
"Programming Languages",
@@ -50,25 +50,24 @@
5050
"git-clang-format": "git-clang-format --extensions=ts"
5151
},
5252
"dependencies": {
53-
"@clangd/install": "0.1.17",
54-
"abort-controller": "^3.0.0",
55-
"vscode-languageclient": "8.0.2"
53+
"@clangd/install": "0.1.19",
54+
"vscode-languageclient": "^9.0.1"
5655
},
5756
"devDependencies": {
58-
"@types/glob": "^7.1.1",
59-
"@types/mocha": "^7.0.2",
60-
"@types/node": "^6.0.40",
61-
"@types/sinon": "^10.0.16",
62-
"@types/vscode": "1.65.0",
63-
"clang-format": "^1.7.0",
64-
"esbuild": "^0.14.13",
65-
"glob": "^7.1.4",
66-
"mocha": "^9.2.0",
67-
"ovsx": "^0.3.0",
68-
"sinon": "^15.2.0",
69-
"typescript": "^4.5.5",
70-
"vsce": "^2.7.0",
71-
"vscode-test": "^1.3.0"
57+
"@types/glob": "^8.1.0",
58+
"@types/mocha": "^10.0.7",
59+
"@types/node": "^22.0.2",
60+
"@types/sinon": "^17.0.3",
61+
"@types/vscode": "1.97.0",
62+
"@vscode/test-electron": "^2.4.1",
63+
"@vscode/vsce": "^3.2.2",
64+
"clang-format": "^1.8.0",
65+
"esbuild": "^0.25.0",
66+
"glob": "^11.0.0",
67+
"mocha": "^11.1.0",
68+
"ovsx": "^0.10.1",
69+
"sinon": "^19.0.2",
70+
"typescript": "^5.5.4"
7271
},
7372
"repository": {
7473
"type": "git",

src/ast.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class ASTFeature implements vscodelc.StaticFeature {
6969
'astProvider' in capabilities);
7070
}
7171
getState(): vscodelc.FeatureState { return {kind: 'static'}; }
72-
dispose() {}
72+
clear() {}
7373
}
7474

7575
// Icons used for nodes of particular roles and kinds. (Kind takes precedence).

src/clangd-context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class EnableEditsNearCursorFeature implements vscodelc.StaticFeature {
5353
extendedCompletionCapabilities.editsNearCursor = true;
5454
}
5555
getState(): vscodelc.FeatureState { return {kind: 'static'}; }
56-
dispose() {}
56+
clear() {}
5757
}
5858

5959
export class ClangdContext implements vscode.Disposable {

src/config-file-watcher.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ class ConfigFileWatcherFeature implements vscodelc.StaticFeature {
2727
this.context.subscriptions.push(new ConfigFileWatcher(this.context));
2828
}
2929
getState(): vscodelc.FeatureState { return {kind: 'static'}; }
30-
dispose() {}
30+
clear() {}
3131
}
3232

3333
class ConfigFileWatcher implements vscode.Disposable {
3434
private databaseWatcher?: vscode.FileSystemWatcher;
35-
private debounceTimer?: NodeJS.Timer;
35+
private debounceTimer?: NodeJS.Timeout;
3636

3737
dispose() {
3838
if (this.databaseWatcher)

src/config.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ function substitute<T>(val: T): T {
2020
// If there's no replacement available, keep the placeholder.
2121
return replacement(name) ?? match;
2222
}) as unknown as T;
23-
} else if (Array.isArray(val))
23+
} else if (Array.isArray(val)) {
2424
val = val.map((x) => substitute(x)) as unknown as T;
25-
else if (typeof val === 'object') {
25+
} else if (typeof val === 'object') {
2626
// Substitute values but not keys, so we don't deal with collisions.
2727
const result = {} as {[k: string]: any};
28-
for (let [k, v] of Object.entries(val))
29-
result[k] = substitute(v);
28+
for (const key in val) {
29+
result[key] = substitute(val[key]);
30+
}
3031
val = result as T;
3132
}
3233
return val;

src/inactive-regions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,5 +120,5 @@ export class InactiveRegionsFeature implements vscodelc.StaticFeature {
120120

121121
// clears inactive region decorations on disposal so they don't persist after
122122
// extension is deactivated
123-
dispose() { this.decorationType?.dispose(); }
124-
}
123+
clear() { this.decorationType?.dispose(); }
124+
}

src/inlay-hints.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class InlayHintsFeature implements vscodelc.StaticFeature {
9393
clangdDocumentSelector, new Provider(this.context)));
9494
}
9595
getState(): vscodelc.FeatureState { return {kind: 'static'}; }
96-
dispose() {}
96+
clear() {}
9797
}
9898

9999
class Provider implements vscode.InlayHintsProvider {

src/install.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// This wraps `@clangd/install` in the VSCode UI. See that package for more.
33

44
import * as common from '@clangd/install';
5-
import AbortController from 'abort-controller';
65
import * as path from 'path';
76
import * as vscode from 'vscode';
87

@@ -57,6 +56,13 @@ class UI {
5756
});
5857
return Promise.resolve(result); // Thenable to real promise.
5958
}
59+
localize(message: string, ...args: Array<string|number|boolean>): string {
60+
let ret = message;
61+
for (const i in args) {
62+
ret.replace(`{${i}}`, args[i].toString());
63+
}
64+
return ret;
65+
}
6066
error(s: string) { vscode.window.showErrorMessage(s); }
6167
info(s: string) { vscode.window.showInformationMessage(s); }
6268
command(name: string, body: () => any) {

src/memory-usage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class MemoryUsageFeature implements vscodelc.StaticFeature {
7575
'memoryUsageProvider' in capabilities);
7676
}
7777
getState(): vscodelc.FeatureState { return {kind: 'static'}; }
78-
dispose() {}
78+
clear() {}
7979
}
8080

8181
class TreeAdapter implements vscode.TreeDataProvider<InternalTree> {

0 commit comments

Comments
 (0)