@knip/language-server 1.1.1 → 1.2.0

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 +2 -2
  2. package/src/server.js +11 -1
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.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -12,7 +12,7 @@
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.0"
16
16
  },
17
17
  "engines": {
18
18
  "node": ">=18.18.0"
package/src/server.js CHANGED
@@ -1,3 +1,4 @@
1
+ import fs from 'node:fs';
1
2
  import path from 'node:path';
2
3
  import { fileURLToPath, pathToFileURL } from 'node:url';
3
4
  import { createOptions, createSession, KNIP_CONFIG_LOCATIONS } from 'knip/session';
@@ -23,6 +24,9 @@ import {
23
24
  } from './constants.js';
24
25
  import { issueToDiagnostic } from './diagnostics.js';
25
26
 
27
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
28
+ const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8'));
29
+
26
30
  const RESTART_FOR = new Set(['package.json', ...KNIP_CONFIG_LOCATIONS]);
27
31
 
28
32
  /** @param {string} value */
@@ -98,7 +102,13 @@ export class LanguageServer {
98
102
  },
99
103
  };
100
104
 
101
- return { capabilities };
105
+ return {
106
+ capabilities,
107
+ serverInfo: {
108
+ name: pkg.name,
109
+ version: pkg.version,
110
+ },
111
+ };
102
112
  });
103
113
 
104
114
  this.connection.onInitialized(() => {});