@knip/language-server 0.0.2 → 0.0.3
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/package.json +4 -4
- package/src/server.js +13 -1
- package/src/types.d.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knip/language-server",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
"./constants": "./src/constants.js"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
+
"knip": "^5.75.2",
|
|
13
14
|
"vscode-languageserver": "^9.0.1",
|
|
14
|
-
"vscode-languageserver-textdocument": "^1.0.12"
|
|
15
|
-
"knip": "5.75.1"
|
|
15
|
+
"vscode-languageserver-textdocument": "^1.0.12"
|
|
16
16
|
},
|
|
17
17
|
"engines": {
|
|
18
18
|
"node": ">=18.18.0"
|
|
19
19
|
}
|
|
20
|
-
}
|
|
20
|
+
}
|
package/src/server.js
CHANGED
|
@@ -172,8 +172,20 @@ export class LanguageServer {
|
|
|
172
172
|
const config = await this.getConfig();
|
|
173
173
|
if (!config?.enabled) return;
|
|
174
174
|
|
|
175
|
+
const configFilePath = config.configFilePath
|
|
176
|
+
? path.isAbsolute(config.configFilePath)
|
|
177
|
+
? config.configFilePath
|
|
178
|
+
: path.resolve(this.cwd ?? process.cwd(), config.configFilePath)
|
|
179
|
+
: undefined;
|
|
180
|
+
|
|
181
|
+
if (configFilePath) {
|
|
182
|
+
this.cwd = path.dirname(configFilePath);
|
|
183
|
+
process.chdir(this.cwd);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
|
|
175
187
|
this.connection.console.log('Creating options');
|
|
176
|
-
const options = await createOptions({ cwd: this.cwd, isSession: true });
|
|
188
|
+
const options = await createOptions({ cwd: this.cwd, isSession: true, args: { config: configFilePath } });
|
|
177
189
|
this.rules = options.rules;
|
|
178
190
|
|
|
179
191
|
this.connection.console.log('Building module graph...');
|