Skip to content

Commit aa34126

Browse files
committed
Clean up and refactor VSCode integration.
- Fixed linter/prettier mixups during development. - Cleaned up web config injection, removed separate NLS injection. - Cleaned up comments for use with intellisense - Updated types to more often use VScode's built in types. - Cleaned up URI helpers. - Organized connection classes into separate files. - Documented protocol usage, adding trace logging support. - Fleshed out partial support for remote debugging. - Updated tests.
1 parent 30dc47d commit aa34126

File tree

81 files changed

+2600
-2384
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+2600
-2384
lines changed

.editorconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,9 @@ root = true
33
[*]
44
indent_style = space
55
trim_trailing_whitespace = true
6+
7+
# The indent size used in the `package.json` file cannot be changed
8+
# https://github.com/npm/npm/pull/3180#issuecomment-16336516
9+
[{*.yml,*.yaml,package.json}]
10+
indent_style = space
611
indent_size = 2

.prettierrc.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,16 @@ printWidth: 120
22
semi: false
33
trailingComma: all
44
arrowParens: always
5+
singleQuote: false
6+
useTabs: false
7+
8+
overrides:
9+
# Attempt to keep VScode's existing code style intact.
10+
- files: "lib/vscode/**/*.ts"
11+
options:
12+
# No limit defined upstream.
13+
printWidth: 10000
14+
semi: true
15+
singleQuote: true
16+
useTabs: true
17+
arrowParens: avoid

lib/vscode/.eslintrc.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,12 +802,14 @@
802802
"target": "**/vs/server/**",
803803
"restrictions": [
804804
"vs/nls",
805+
// @coder Allow additional imports until our server structure aligns with upstream.
806+
"**/vs/code/**/{common,server,browser,node,electron-sandbox,electron-browser}/**",
805807
"**/vs/base/**/{common,node}/**",
806808
"**/vs/base/parts/**/{common,node}/**",
807809
"**/vs/platform/**/{common,node}/**",
808810
"**/vs/workbench/**/{common,node}/**",
811+
"**/vs/workbench/workbench.web.api",
809812
"**/vs/server/**",
810-
"@coder/logger", // NOTE@coder: add logger
811813
"*" // node modules
812814
]
813815
},

lib/vscode/.vscode/settings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,13 @@
8484
"editor.defaultFormatter": "vscode.typescript-language-features",
8585
"editor.formatOnSave": true,
8686
},
87+
// @coder Attempt to keep loose formatters inline with upstream's code style.
88+
"typescript.format.insertSpaceAfterConstructor": false,
89+
"javascript.format.insertSpaceAfterConstructor": false,
90+
"javascript.format.insertSpaceBeforeFunctionParenthesis": false,
91+
"typescript.format.insertSpaceBeforeFunctionParenthesis": false,
92+
"typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": false,
93+
"javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": false,
8794
"typescript.tsc.autoDetect": "off",
8895
"notebook.experimental.useMarkdownRenderer": true,
8996
"testing.autoRun.mode": "rerun",

lib/vscode/build/gulpfile.reh.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ BUILD_TARGETS.forEach(({ platform, arch }) => {
4242
});
4343

4444
function getNodeVersion() {
45-
// NOTE@coder: Fix version due to .yarnrc removal.
46-
return process.versions.node;
4745
const yarnrc = fs.readFileSync(path.join(REPO_ROOT, 'remote', '.yarnrc'), 'utf8');
4846
const target = /^target "(.*)"$/m.exec(yarnrc)[1];
4947
return target;

lib/vscode/build/hygiene.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,18 @@ const copyrightHeaderLines = [
1919
' *--------------------------------------------------------------------------------------------*/',
2020
];
2121

22+
/**
23+
* @remark While this helps delineate Coder's additions to the upstream project,
24+
* this notice should be examined within the context of the application.
25+
* Code from both maintainers often overlaps.
26+
*/
27+
const coderCopyrightHeaderLines = [
28+
'/*---------------------------------------------------------------------------------------------',
29+
' * Copyright (c) Coder Technologies. All rights reserved.',
30+
' * Licensed under the MIT License. See License.txt in the project root for license information.',
31+
' *--------------------------------------------------------------------------------------------*/',
32+
];
33+
2234
function hygiene(some, linting = true) {
2335
const gulpeslint = require('gulp-eslint');
2436
const tsfmt = require('typescript-formatter');
@@ -62,7 +74,7 @@ function hygiene(some, linting = true) {
6274
const lines = file.__lines;
6375

6476
for (let i = 0; i < copyrightHeaderLines.length; i++) {
65-
if (lines[i] !== copyrightHeaderLines[i]) {
77+
if (lines[i] !== copyrightHeaderLines[i] && lines[i] !== coderCopyrightHeaderLines[i]) {
6678
console.error(file.relative + ': Missing or bad copyright statement');
6779
errorCount++;
6880
break;

lib/vscode/build/lib/node.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ const path = require("path");
88
const fs = require("fs");
99
const root = path.dirname(path.dirname(__dirname));
1010
const yarnrcPath = path.join(root, 'remote', '.yarnrc');
11-
// NOTE@coder: Fix version due to .yarnrc removal.
12-
const version = process.versions.node;
11+
const yarnrc = fs.readFileSync(yarnrcPath, 'utf8');
12+
const version = /^target\s+"([^"]+)"$/m.exec(yarnrc)[1];
1313
const platform = process.platform;
1414
const arch = platform === 'darwin' ? 'x64' : process.arch;
1515
const node = platform === 'win32' ? 'node.exe' : 'node';

lib/vscode/build/lib/node.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import * as path from 'path';
7+
import * as fs from 'fs';
78

89
const root = path.dirname(path.dirname(__dirname));
10+
const yarnrcPath = path.join(root, 'remote', '.yarnrc');
11+
const yarnrc = fs.readFileSync(yarnrcPath, 'utf8');
12+
const version = /^target\s+"([^"]+)"$/m.exec(yarnrc)![1];
913

10-
// NOTE@coder: Fix version due to .yarnrc removal.
11-
const version = process.versions.node;
1214
const platform = process.platform;
1315
const arch = platform === 'darwin' ? 'x64' : process.arch;
1416

lib/vscode/build/lib/util.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ export function streamToPromise(stream: NodeJS.ReadWriteStream): Promise<void> {
336336
}
337337

338338
export function getElectronVersion(): string {
339-
// NOTE@coder: Fix version due to .yarnrc removal.
340-
return process.versions.node;
339+
const yarnrc = fs.readFileSync(path.join(root, '.yarnrc'), 'utf8');
340+
const target = /^target "(.*)"$/m.exec(yarnrc)![1];
341+
return target;
341342
}

lib/vscode/build/lib/watch/yarn.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@ fsevents@~2.3.1:
148148
integrity sha512-YR47Eg4hChJGAB1O3yEAOkGO+rlzutoICGqGo9EZ4lKWokzZRSyIW1QmTzqjtw8MJdj9srP869CuWw/hyzSiBw==
149149

150150
glob-parent@^5.1.1, glob-parent@~5.1.0:
151-
version "5.1.2"
152-
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4"
153-
integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==
151+
version "5.1.1"
152+
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.1.tgz#b6c1ef417c4e5663ea498f1c45afac6916bbc229"
153+
integrity sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==
154154
dependencies:
155155
is-glob "^4.0.1"
156156

0 commit comments

Comments
 (0)