Skip to content

Commit dce7ecf

Browse files
committed
Extension Development Improvements
1. Updated tasks.json to 2.0 2. Added tslint problem matcher - Weird issue that problem does not disappear when resolved. 3. Adding tslint for class and function names. - class must be in PascalCase - funcitons must be in camelCase 4. Addressing vulnerability warning - microsoft/vscode#49146
1 parent 8deee74 commit dce7ecf

11 files changed

+129
-89
lines changed

Extension/.vscode/launch.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"outFiles": [
1616
"${workspaceFolder}/out/**/*.js"
1717
],
18-
"preLaunchTask": "npm"
18+
"preLaunchTask": "compile",
1919
},
2020
{
2121
"name": "Launch Tests",
@@ -31,7 +31,7 @@
3131
"outFiles": [
3232
"${workspaceFolder}/out/test/**/*.js"
3333
],
34-
"preLaunchTask": "npm"
34+
"preLaunchTask": "compile"
3535
},
3636
{
3737
"name": "Node Attach",

Extension/.vscode/tasks.json

+58-28
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,60 @@
1-
// Available variables which can be used inside of strings.
2-
// ${workspaceRoot}: the root folder of the team
3-
// ${file}: the current opened file
4-
// ${fileBasename}: the current opened file's basename
5-
// ${fileDirname}: the current opened file's dirname
6-
// ${fileExtname}: the current opened file's extension
7-
// ${cwd}: the current working directory of the spawned process
8-
9-
// A task runner that calls a custom npm script that compiles the extension.
101
{
11-
"version": "0.1.0",
12-
13-
// we want to run npm
14-
"command": "npm",
15-
16-
// the command is a shell script
17-
"isShellCommand": true,
18-
19-
// show the output window only if unrecognized errors occur.
20-
"showOutput": "silent",
21-
22-
// we run the custom script "compile" as defined in package.json
23-
"args": ["run", "compile", "--loglevel", "silent"],
24-
25-
// The tsc compiler is started in watching mode
26-
"isWatching": true,
27-
28-
// use the standard tsc in watch mode problem matcher to find compile problems in the output.
29-
"problemMatcher": "$tsc-watch"
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "TypeScript Compile",
8+
"identifier": "compile",
9+
"group": {
10+
"kind": "build",
11+
"isDefault": true
12+
},
13+
"isBackground": true,
14+
"type": "shell",
15+
"presentation": {
16+
"echo": true,
17+
"reveal": "silent",
18+
"focus": false,
19+
"panel": "shared"
20+
},
21+
"command": "npm",
22+
"args": [
23+
"run",
24+
"compile",
25+
"--loglevel",
26+
"silent"
27+
],
28+
"problemMatcher": "$tsc-watch"
29+
},
30+
{
31+
"label": "TypeScript Lint",
32+
"identifier": "tslint",
33+
"group": "build",
34+
"isBackground": false,
35+
"type": "shell",
36+
"command": "npm",
37+
"args": [
38+
"run",
39+
"tslint"
40+
],
41+
"problemMatcher": {
42+
"fileLocation": "absolute",
43+
"source": "tslint",
44+
"pattern": [
45+
{
46+
"regexp": "(ERROR:) ([a-zA-Z/:\\-\\.]*)\\[(\\d+), (\\d+)\\]: (.*)",
47+
"severity": 1,
48+
"file": 2,
49+
"line": 3,
50+
"column": 4,
51+
"message": 5
52+
}
53+
]
54+
},
55+
"dependsOn": [
56+
"compile"
57+
]
58+
}
59+
]
3060
}

Extension/gulpfile.js

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ gulp.task('integrationTests', () => {
5252
/// Misc Tasks
5353
const allTypeScript = [
5454
'src/**/*.ts',
55+
'tools/**/*.ts',
5556
'!**/*.d.ts',
5657
'!**/typings**'
5758
];

Extension/package-lock.json

+16-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Extension/package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -1290,16 +1290,17 @@
12901290
"devDependencies": {
12911291
"@types/mocha": "^2.2.43",
12921292
"@types/node": "^8.0.46",
1293+
"gulp": "3.9.1",
12931294
"gulp-env": "0.4.0",
12941295
"gulp-mocha": "5.0.0",
12951296
"gulp-tslint": "8.1.2",
1296-
"gulp": "3.9.1",
12971297
"mocha": "^4.0.1",
1298+
"tslint": "5.8.0",
12981299
"tslint-microsoft-contrib": "5.0.1",
12991300
"tslint-no-unused-expression-chai": "0.0.3",
1300-
"tslint": "5.8.0",
13011301
"typescript": "^2.5.3",
1302-
"vscode": "^1.1.14"
1302+
"vrsource-tslint-rules": "^5.8.2",
1303+
"vscode": "^1.1.17"
13031304
},
13041305
"dependencies": {
13051306
"http-proxy-agent": "~2.0.0",

Extension/src/Debugger/configurations.ts

+16-16
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function formatString(format: string, args: string[]): string {
3131
return format;
3232
}
3333

34-
function CreateLaunchString(name: string, type: string, executable: string): string {
34+
function createLaunchString(name: string, type: string, executable: string): string {
3535
return `"name": "${name}",
3636
"type": "${type}",
3737
"request": "launch",
@@ -44,7 +44,7 @@ function CreateLaunchString(name: string, type: string, executable: string): str
4444
`;
4545
}
4646

47-
function CreateAttachString(name: string, type: string, executable: string): string {
47+
function createAttachString(name: string, type: string, executable: string): string {
4848
return formatString(`
4949
"name": "${name}",
5050
"type": "${type}",
@@ -53,7 +53,7 @@ function CreateAttachString(name: string, type: string, executable: string): str
5353
`, [type === "cppdbg" ? `${os.EOL}"program": "${"enter program name, for example $\{workspaceFolder\}/" + executable}",` : ""]);
5454
}
5555

56-
function CreateRemoteAttachString(name: string, type: string, executable: string): string {
56+
function createRemoteAttachString(name: string, type: string, executable: string): string {
5757
return `
5858
"name": "${name}",
5959
"type": "${type}",
@@ -63,7 +63,7 @@ function CreateRemoteAttachString(name: string, type: string, executable: string
6363
`;
6464
}
6565

66-
function CreatePipeTransportString(pipeProgram: string, debuggerProgram: string, pipeArgs: string[] = []): string {
66+
function createPipeTransportString(pipeProgram: string, debuggerProgram: string, pipeArgs: string[] = []): string {
6767
return `
6868
"pipeTransport": {
6969
\t"debuggerPath": "/usr/bin/${debuggerProgram}",
@@ -106,7 +106,7 @@ export class MIConfigurations extends Configuration {
106106
let name: string = `(${this.MIMode}) Launch`;
107107

108108
let body: string = formatString(`{
109-
\t${indentJsonString(CreateLaunchString(name, this.miDebugger, this.executable))},
109+
\t${indentJsonString(createLaunchString(name, this.miDebugger, this.executable))},
110110
\t"MIMode": "${this.MIMode}"{0}{1}
111111
}`, [this.miDebugger === "cppdbg" && os.platform() === "win32" ? `,${os.EOL}\t"miDebuggerPath": "/path/to/gdb"` : "",
112112
this.additionalProperties ? `,${os.EOL}\t${indentJsonString(this.additionalProperties)}` : ""]);
@@ -124,7 +124,7 @@ this.additionalProperties ? `,${os.EOL}\t${indentJsonString(this.additionalPrope
124124
let name: string = `(${this.MIMode}) Attach`;
125125

126126
let body: string = formatString(`{
127-
\t${indentJsonString(CreateAttachString(name, this.miDebugger, this.executable))},
127+
\t${indentJsonString(createAttachString(name, this.miDebugger, this.executable))},
128128
\t"MIMode": "${this.MIMode}"{0}{1}
129129
}`, [this.miDebugger === "cppdbg" && os.platform() === "win32" ? `,${os.EOL}\t"miDebuggerPath": "/path/to/gdb"` : "",
130130
this.additionalProperties ? `,${os.EOL}\t${indentJsonString(this.additionalProperties)}` : ""]);
@@ -146,8 +146,8 @@ export class PipeTransportConfigurations extends Configuration {
146146

147147
let body: string = formatString(`
148148
{
149-
\t${indentJsonString(CreateLaunchString(name, this.miDebugger, this.executable))},
150-
\t${indentJsonString(CreatePipeTransportString(this.pipeProgram, this.MIMode))},
149+
\t${indentJsonString(createLaunchString(name, this.miDebugger, this.executable))},
150+
\t${indentJsonString(createPipeTransportString(this.pipeProgram, this.MIMode))},
151151
\t"MIMode": "${this.MIMode}"{0}
152152
}`, [this.additionalProperties ? `,${os.EOL}\t${indentJsonString(this.additionalProperties)}` : ""]);
153153

@@ -165,8 +165,8 @@ export class PipeTransportConfigurations extends Configuration {
165165

166166
let body: string = formatString(`
167167
{
168-
\t${indentJsonString(CreateRemoteAttachString(name, this.miDebugger, this.executable))},
169-
\t${indentJsonString(CreatePipeTransportString(this.pipeProgram, this.MIMode))},
168+
\t${indentJsonString(createRemoteAttachString(name, this.miDebugger, this.executable))},
169+
\t${indentJsonString(createPipeTransportString(this.pipeProgram, this.MIMode))},
170170
\t"MIMode": "${this.MIMode}"{0}
171171
}`, [this.additionalProperties ? `,${os.EOL}\t${indentJsonString(this.additionalProperties)}` : ""]);
172172
return {
@@ -186,7 +186,7 @@ export class WindowsConfigurations extends Configuration {
186186

187187
let body: string = `
188188
{
189-
\t${indentJsonString(CreateLaunchString(name, this.windowsDebugger, this.executable))}
189+
\t${indentJsonString(createLaunchString(name, this.windowsDebugger, this.executable))}
190190
}`;
191191

192192
return {
@@ -204,7 +204,7 @@ export class WindowsConfigurations extends Configuration {
204204

205205
let body: string = `
206206
{
207-
\t${indentJsonString(CreateAttachString(name, this.windowsDebugger, this.executable))}
207+
\t${indentJsonString(createAttachString(name, this.windowsDebugger, this.executable))}
208208
}`;
209209

210210
return {
@@ -226,8 +226,8 @@ export class WSLConfigurations extends Configuration {
226226

227227
let body: string = formatString(`
228228
{
229-
\t${indentJsonString(CreateLaunchString(name, this.miDebugger, this.executable))},
230-
\t${indentJsonString(CreatePipeTransportString(this.bashPipeProgram, this.MIMode, ["-c"]))}{0}
229+
\t${indentJsonString(createLaunchString(name, this.miDebugger, this.executable))},
230+
\t${indentJsonString(createPipeTransportString(this.bashPipeProgram, this.MIMode, ["-c"]))}{0}
231231
}`, [this.additionalProperties ? `,${os.EOL}\t${indentJsonString(this.additionalProperties)}` : ""]);
232232

233233
return {
@@ -243,8 +243,8 @@ export class WSLConfigurations extends Configuration {
243243

244244
let body: string = formatString(`
245245
{
246-
\t${indentJsonString(CreateRemoteAttachString(name, this.miDebugger, this.executable))},
247-
\t${indentJsonString(CreatePipeTransportString(this.bashPipeProgram, this.MIMode, ["-c"]))}{0}
246+
\t${indentJsonString(createRemoteAttachString(name, this.miDebugger, this.executable))},
247+
\t${indentJsonString(createPipeTransportString(this.bashPipeProgram, this.MIMode, ["-c"]))}{0}
248248
}`, [this.additionalProperties ? `,${os.EOL}\t${indentJsonString(this.additionalProperties)}` : ""]);
249249

250250
return {

Extension/src/abTesting.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function downloadCpptoolsJson(urlString): Promise<void> {
3535
let request: ClientRequest = https.request({
3636
host: parsedUrl.host,
3737
path: parsedUrl.path,
38-
agent: util.GetHttpsProxyAgent(),
38+
agent: util.getHttpsProxyAgent(),
3939
rejectUnauthorized: vscode.workspace.getConfiguration().get("http.proxyStrictSSL", true)
4040
}, (response) => {
4141
if (response.statusCode === 301 || response.statusCode === 302) {

Extension/src/common.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ export function getDebugAdaptersPath(file: string): string {
206206
return path.resolve(getExtensionFilePath("debugAdapters"), file);
207207
}
208208

209-
export function GetHttpsProxyAgent(): HttpsProxyAgent {
209+
export function getHttpsProxyAgent(): HttpsProxyAgent {
210210
let proxy: string = vscode.workspace.getConfiguration().get<string>('http.proxy');
211211
if (!proxy) {
212212
proxy = process.env.HTTPS_PROXY || process.env.https_proxy || process.env.HTTP_PROXY || process.env.http_proxy;

Extension/src/packageManager.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ export class PackageManager {
223223
let options: https.RequestOptions = {
224224
host: parsedUrl.host,
225225
path: parsedUrl.path,
226-
agent: util.GetHttpsProxyAgent(),
226+
agent: util.getHttpsProxyAgent(),
227227
rejectUnauthorized: proxyStrictSSL
228228
};
229229

0 commit comments

Comments
 (0)