@knip/language-server 1.1.1 → 1.2.1

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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/src/server.js +11 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knip/language-server",
3
- "version": "1.1.1",
3
+ "version": "1.2.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -12,10 +12,10 @@
12
12
  "dependencies": {
13
13
  "vscode-languageserver": "^9.0.1",
14
14
  "vscode-languageserver-textdocument": "^1.0.12",
15
- "knip": "^5.82.0"
15
+ "knip": "^5.83.1"
16
16
  },
17
17
  "engines": {
18
- "node": ">=18.18.0"
18
+ "node": ">=18.20.0"
19
19
  },
20
20
  "scripts": {
21
21
  "release": "release-it -c ../../.release-it.json"
package/src/server.js CHANGED
@@ -4,6 +4,7 @@ import { createOptions, createSession, KNIP_CONFIG_LOCATIONS } from 'knip/sessio
4
4
  import { FileChangeType, ProposedFeatures, TextDocuments } from 'vscode-languageserver';
5
5
  import { CodeActionKind, createConnection } from 'vscode-languageserver/node.js';
6
6
  import { TextDocument } from 'vscode-languageserver-textdocument';
7
+ import pkg from '../package.json' with { type: 'json' };
7
8
  import {
8
9
  createAddJSDocTagEdit,
9
10
  createDeleteFileEdit,
@@ -98,7 +99,13 @@ export class LanguageServer {
98
99
  },
99
100
  };
100
101
 
101
- return { capabilities };
102
+ return {
103
+ capabilities,
104
+ serverInfo: {
105
+ name: pkg.name,
106
+ version: pkg.version,
107
+ },
108
+ };
102
109
  });
103
110
 
104
111
  this.connection.onInitialized(() => {});
@@ -360,6 +367,7 @@ export class LanguageServer {
360
367
  }
361
368
 
362
369
  if (issueType === 'unlisted') {
370
+ const workspacePath = path.resolve(this.cwd ?? process.cwd(), issue.workspace);
363
371
  codeActions.push({
364
372
  title: `Install '${issue.symbol}' as dependency`,
365
373
  kind: CodeActionKind.QuickFix,
@@ -367,7 +375,7 @@ export class LanguageServer {
367
375
  command: {
368
376
  title: `Install '${issue.symbol}' as dependency`,
369
377
  command: 'knip.installDependency',
370
- arguments: [issue.symbol, 'dependencies', issue.workspace],
378
+ arguments: [issue.symbol, 'dependencies', workspacePath],
371
379
  },
372
380
  });
373
381
 
@@ -378,7 +386,7 @@ export class LanguageServer {
378
386
  command: {
379
387
  title: `Install '${issue.symbol}' as devDependency`,
380
388
  command: 'knip.installDependency',
381
- arguments: [issue.symbol, 'devDependencies', issue.workspace],
389
+ arguments: [issue.symbol, 'devDependencies', workspacePath],
382
390
  },
383
391
  });
384
392
  }