vscode-eslint 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.
@@ -8,17 +8,18 @@
8
8
  'use strict';
9
9
 
10
10
  const path = require('path');
11
- const { spawn } = require('child_process');
11
+ const pkg = require('../package.json');
12
12
 
13
13
  function usage(exitCode = 0) {
14
14
  const msg = [
15
- 'vscode-eslint (LSP server)',
15
+ `vscode-eslint (LSP server) v${pkg.version}`,
16
16
  '',
17
17
  'Usage:',
18
18
  ' vscode-eslint --stdio',
19
19
  '',
20
20
  'Options:',
21
21
  ' --stdio Use stdio transport (LSP over JSON-RPC on stdin/stdout)',
22
+ ' --version Show version',
22
23
  ' -h, --help Show this help',
23
24
  ].join('\n');
24
25
  if (exitCode === 0) {
@@ -34,6 +35,11 @@ if (args.includes('-h') || args.includes('--help')) {
34
35
  usage(0);
35
36
  }
36
37
 
38
+ if (args.includes('--version')) {
39
+ process.stdout.write(`${pkg.version}\n`);
40
+ process.exit(0);
41
+ }
42
+
37
43
  const wantsStdio = args.includes('--stdio');
38
44
  if (!wantsStdio) {
39
45
  process.stderr.write('error: missing required --stdio\n\n');
@@ -41,16 +47,13 @@ if (!wantsStdio) {
41
47
  }
42
48
 
43
49
  // Run the bundled server produced by server/webpack.config.js
50
+ // We require it directly so it runs in the same process,
51
+ // similar to how typescript-language-server and other LSPs are structured.
44
52
  const serverEntry = path.resolve(__dirname, '..', 'server', 'out', 'eslintServer.js');
45
53
 
46
- const child = spawn(process.execPath, [serverEntry], {
47
- stdio: 'inherit'
48
- });
49
-
50
- child.on('exit', (code, signal) => {
51
- if (signal) {
52
- process.exitCode = 1;
53
- return;
54
- }
55
- process.exitCode = code ?? 0;
56
- });
54
+ try {
55
+ require(serverEntry);
56
+ } catch (err) {
57
+ process.stderr.write(`Failed to start ESLint server: ${err.message}\n`);
58
+ process.exit(1);
59
+ }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "vscode-eslint",
3
3
  "displayName": "ESLint",
4
4
  "description": "Integrates ESLint JavaScript into VS Code.",
5
- "version": "0.0.2",
5
+ "version": "0.0.3",
6
6
  "author": "Microsoft Corporation",
7
7
  "license": "MIT",
8
8
  "repository": {
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "publisher": "dbaeumer",
16
16
  "bin": {
17
- "vscode-eslint": "bin/vscode-eslint.js"
17
+ "vscode-eslint": "bin/vscode-eslint"
18
18
  },
19
19
  "icon": "eslint_icon.png",
20
20
  "categories": [