Skip to content

Commit ecd1b06

Browse files
authored
1 parent dfec64f commit ecd1b06

16 files changed

+66
-65
lines changed

Extension/src/Debugger/attachToProcess.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,34 +96,34 @@ export class RemoteAttachPicker {
9696
// Processess will follow if listed
9797
let lines: string[] = output.split(/\r?\n/);
9898

99-
if (lines.length == 0) {
99+
if (lines.length === 0) {
100100
return Promise.reject<AttachItem[]>(new Error("Pipe transport failed to get OS and processes."));
101101
} else {
102102
let remoteOS: string = lines[0].replace(/[\r\n]+/g, '');
103103

104-
if (remoteOS != "Linux" && remoteOS != "Darwin") {
104+
if (remoteOS !== "Linux" && remoteOS !== "Darwin") {
105105
return Promise.reject<AttachItem[]>(new Error(`Operating system "${remoteOS}" not supported.`));
106106
}
107107

108108
// Only got OS from uname
109-
if (lines.length == 1) {
109+
if (lines.length === 1) {
110110
return Promise.reject<AttachItem[]>(new Error("Transport attach could not obtain processes list."));
111111
} else {
112112
let processes: string[] = lines.slice(1);
113113
return PsProcessParser.ParseProcessFromPsArray(processes)
114114
.sort((a, b) => {
115-
if (a.name == undefined) {
116-
if (b.name == undefined) {
115+
if (a.name === undefined) {
116+
if (b.name === undefined) {
117117
return 0;
118118
}
119119
return 1;
120120
}
121-
if (b.name == undefined) {
121+
if (b.name === undefined) {
122122
return -1;
123123
}
124124
let aLower: string = a.name.toLowerCase();
125125
let bLower: string = b.name.toLowerCase();
126-
if (aLower == bLower) {
126+
if (aLower === bLower) {
127127
return 0;
128128
}
129129
return aLower < bLower ? -1 : 1;

Extension/src/Debugger/configurationProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ abstract class DefaultConfigurationProvider implements IConfigurationAssetProvid
8181
configurationSnippet.push(configuration.GetLaunchConfiguration());
8282
});
8383

84-
let initialConfigurations: any = configurationSnippet.filter(snippet => snippet.debuggerType == debuggerType && snippet.isInitialConfiguration)
84+
let initialConfigurations: any = configurationSnippet.filter(snippet => snippet.debuggerType === debuggerType && snippet.isInitialConfiguration)
8585
.map(snippet => JSON.parse(snippet.bodyText));
8686

8787
// If configurations is empty, then it will only have an empty configurations array in launch.json. Users can still add snippets.

Extension/src/Debugger/copyScript.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function findCppToolsExtensionDebugAdapterFolder(): string {
6363
}
6464
}
6565

66-
if (dirPath == os.homedir()) {
66+
if (dirPath === os.homedir()) {
6767
console.error("Could not find installed C/C++ extension.");
6868
return null;
6969
}
@@ -81,7 +81,7 @@ function enableDevWorkflow(): Boolean {
8181
return false;
8282
}
8383

84-
return (EnableDevWorkflow || (process.env.CPPTOOLS_DEV != null));
84+
return (EnableDevWorkflow || (process.env.CPPTOOLS_DEV !== null));
8585
}
8686

8787
function copySourceDependencies(): void {

Extension/src/Debugger/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ function registerAdapterExecutableCommands(): void {
7474
}));
7575

7676
disposables.push(vscode.commands.registerCommand('extension.cppvsdbgAdapterExecutableCommand', () => {
77-
if (os.platform() != 'win32') {
77+
if (os.platform() !== 'win32') {
7878
vscode.window.showErrorMessage("Debugger type 'cppvsdbg' is not avaliable for non-Windows machines.");
7979
return null;
8080
} else {

Extension/src/Debugger/nativeAttach.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,18 @@ abstract class NativeAttachItemsProvider implements AttachItemsProvider {
3838
// localeCompare is significantly slower than < and > (2000 ms vs 80 ms for 10,000 elements)
3939
// We can change to localeCompare if this becomes an issue
4040
processEntries.sort((a, b) => {
41-
if (a.name == undefined) {
42-
if (b.name == undefined) {
41+
if (a.name === undefined) {
42+
if (b.name === undefined) {
4343
return 0;
4444
}
4545
return 1;
4646
}
47-
if (b.name == undefined) {
47+
if (b.name === undefined) {
4848
return -1;
4949
}
5050
let aLower: string = a.name.toLowerCase();
5151
let bLower: string = b.name.toLowerCase();
52-
if (aLower == bLower) {
52+
if (aLower === bLower) {
5353
return 0;
5454
}
5555
return aLower < bLower ? -1 : 1;

Extension/src/LanguageServer/client.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ function collectSettings(filter: (key: string, val: string, settings: vscode.Wor
118118
}
119119
if (filter(key, val, settings)) {
120120
previousCppSettings[key] = val;
121-
result[key] = (key == "clang_format_path") ? "..." : String(previousCppSettings[key]);
121+
result[key] = (key === "clang_format_path") ? "..." : String(previousCppSettings[key]);
122122
if (result[key].length > maxSettingLengthForTelemetry) {
123123
result[key] = result[key].substr(0, maxSettingLengthForTelemetry) + "...";
124124
}
@@ -553,7 +553,7 @@ class DefaultClient implements Client {
553553
continue; // File already has an association.
554554
}
555555
let j: number = file.lastIndexOf('.');
556-
if (j != -1) {
556+
if (j !== -1) {
557557
let ext: string = file.substr(j);
558558
if ((("*" + ext) in assocs) || (("**/*" + ext) in assocs)) {
559559
continue; // Extension already has an association.
@@ -739,9 +739,9 @@ class DefaultClient implements Client {
739739
this.notifyWhenReady(() => {
740740
ui.showParsingCommands()
741741
.then((index: number) => {
742-
if (index == 0) {
742+
if (index === 0) {
743743
this.pauseParsing();
744-
} else if (index == 1) {
744+
} else if (index === 1) {
745745
this.resumeParsing();
746746
}
747747
});
@@ -783,11 +783,11 @@ class DefaultClient implements Client {
783783
function getLanguageServerFileName(): string {
784784
let extensionProcessName: string = 'Microsoft.VSCode.CPP.Extension';
785785
let plat: NodeJS.Platform = process.platform;
786-
if (plat == 'linux') {
786+
if (plat === 'linux') {
787787
extensionProcessName += '.linux';
788-
} else if (plat == 'darwin') {
788+
} else if (plat === 'darwin') {
789789
extensionProcessName += '.darwin';
790-
} else if (plat == 'win32') {
790+
} else if (plat === 'win32') {
791791
extensionProcessName += '.exe';
792792
} else {
793793
throw "Invalid Platform";

Extension/src/LanguageServer/configurations.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ export class CppProperties {
203203
if (this.configurationIncomplete && this.defaultIncludes !== undefined && this.defaultFrameworks !== undefined) {
204204
this.configurationJson.configurations[this.CurrentConfiguration].includePath = this.defaultIncludes;
205205
this.configurationJson.configurations[this.CurrentConfiguration].browse.path = this.defaultIncludes;
206-
if (process.platform == 'darwin') {
206+
if (process.platform === 'darwin') {
207207
this.configurationJson.configurations[this.CurrentConfiguration].macFrameworkPath = this.defaultFrameworks;
208208
}
209209
this.configurationIncomplete = false;
@@ -216,15 +216,15 @@ export class CppProperties {
216216
}
217217
let nodePlatform: NodeJS.Platform = process.platform;
218218
let plat: string;
219-
if (nodePlatform == 'linux') {
219+
if (nodePlatform === 'linux') {
220220
plat = "Linux";
221-
} else if (nodePlatform == 'darwin') {
221+
} else if (nodePlatform === 'darwin') {
222222
plat = "Mac";
223-
} else if (nodePlatform == 'win32') {
223+
} else if (nodePlatform === 'win32') {
224224
plat = "Win32";
225225
}
226226
for (let i: number = 0; i < this.configurationJson.configurations.length; i++) {
227-
if (config.configurations[i].name == plat) {
227+
if (config.configurations[i].name === plat) {
228228
return i;
229229
}
230230
}
@@ -233,14 +233,14 @@ export class CppProperties {
233233

234234
private getIntelliSenseModeForPlatform(name: string): string {
235235
// Do the built-in configs first.
236-
if (name == "Linux" || name == "Mac") {
236+
if (name === "Linux" || name === "Mac") {
237237
return "clang-x64";
238-
} else if (name == "Win32") {
238+
} else if (name === "Win32") {
239239
return "msvc-x64";
240240
} else {
241241
// Custom configs default to the OS's preference.
242242
let nodePlatform: NodeJS.Platform = process.platform;
243-
if (nodePlatform == 'linux' || nodePlatform == 'darwin') {
243+
if (nodePlatform === 'linux' || nodePlatform === 'darwin') {
244244
return "clang-x64";
245245
}
246246
}
@@ -266,7 +266,7 @@ export class CppProperties {
266266
}
267267

268268
public select(index: number): Configuration {
269-
if (index == this.configurationJson.configurations.length) {
269+
if (index === this.configurationJson.configurations.length) {
270270
this.handleConfigurationEditCommand(vscode.window.showTextDocument);
271271
return;
272272
}
@@ -319,7 +319,7 @@ export class CppProperties {
319319
});
320320
filePaths.forEach((path: string) => {
321321
this.compileCommandFileWatchers.push(fs.watch(path, (event: string, filename: string) => {
322-
if (event != "rename") {
322+
if (event !== "rename") {
323323
this.onCompileCommandsChanged(path);
324324
}
325325
}));
@@ -389,7 +389,7 @@ export class CppProperties {
389389
private parsePropertiesFile(): void {
390390
try {
391391
let readResults: string = fs.readFileSync(this.propertiesFile.fsPath, 'utf8');
392-
if (readResults == "") {
392+
if (readResults === "") {
393393
return; // Repros randomly when the file is initially created. The parse will get called again after the file is written.
394394
}
395395

@@ -418,7 +418,7 @@ export class CppProperties {
418418
}
419419
}
420420

421-
if (this.configurationJson.version != configVersion) {
421+
if (this.configurationJson.version !== configVersion) {
422422
dirty = true;
423423
if (this.configurationJson.version === undefined) {
424424
this.updateToVersion2();
@@ -477,13 +477,13 @@ export class CppProperties {
477477
let propertiesFile: string = path.join(this.configFolder, "c_cpp_properties.json");
478478
fs.stat(propertiesFile, (err, stats) => {
479479
if (err) {
480-
if (this.propertiesFile != null) {
480+
if (this.propertiesFile !== null) {
481481
this.propertiesFile = null; // File deleted.
482482
this.resetToDefaultSettings(true);
483483
this.handleConfigurationChange();
484484
}
485485
} else if (stats.mtime > this.configFileWatcherFallbackTime) {
486-
if (this.propertiesFile == null) {
486+
if (this.propertiesFile === null) {
487487
this.propertiesFile = vscode.Uri.file(propertiesFile); // File created.
488488
}
489489
this.handleConfigurationChange();

Extension/src/LanguageServer/extension.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export function activate(activationEventOccurred: boolean): void {
8181
if (vscode.workspace.textDocuments !== undefined && vscode.workspace.textDocuments.length > 0) {
8282
for (let i: number = 0; i < vscode.workspace.textDocuments.length; ++i) {
8383
let document: vscode.TextDocument = vscode.workspace.textDocuments[i];
84-
if (document.languageId == "cpp" || document.languageId == "c") {
84+
if (document.languageId === "cpp" || document.languageId === "c") {
8585
return onActivationEvent();
8686
}
8787
}
@@ -95,7 +95,7 @@ function onDidOpenTextDocument(document: vscode.TextDocument): void {
9595
}
9696

9797
function onActivationEvent(): void {
98-
if (tempCommands.length == 0) {
98+
if (tempCommands.length === 0) {
9999
return;
100100
}
101101

@@ -163,7 +163,7 @@ function onDidChangeActiveTextEditor(editor: vscode.TextEditor): void {
163163
}
164164

165165
let activeEditor: vscode.TextEditor = vscode.window.activeTextEditor;
166-
if (!activeEditor || (activeEditor.document.languageId != "cpp" && activeEditor.document.languageId != "c")) {
166+
if (!activeEditor || (activeEditor.document.languageId !== "cpp" && activeEditor.document.languageId !== "c")) {
167167
activeDocument = "";
168168
} else {
169169
activeDocument = editor.document.uri.toString();
@@ -180,7 +180,7 @@ function onDidChangeTextEditorSelection(event: vscode.TextEditorSelectionChangeE
180180
return;
181181
}
182182

183-
if (activeDocument != event.textEditor.document.uri.toString()) {
183+
if (activeDocument !== event.textEditor.document.uri.toString()) {
184184
// For some strange (buggy?) reason we don't reliably get onDidChangeActiveTextEditor callbacks.
185185
activeDocument = event.textEditor.document.uri.toString();
186186
clients.activeDocumentChanged(event.textEditor.document);
@@ -245,7 +245,7 @@ function onSwitchHeaderSource(): void {
245245
return;
246246
}
247247

248-
if (activeEditor.document.languageId != "cpp" && activeEditor.document.languageId != "c") {
248+
if (activeEditor.document.languageId !== "cpp" && activeEditor.document.languageId !== "c") {
249249
return;
250250
}
251251

@@ -379,7 +379,7 @@ function onTakeSurvey(): void {
379379
}
380380

381381
function reportMacCrashes(): void {
382-
if (process.platform == "darwin") {
382+
if (process.platform === "darwin") {
383383
prevCrashFile = "";
384384
let crashFolder: string = path.resolve(process.env.HOME, "Library/Logs/DiagnosticReports");
385385
fs.stat(crashFolder, (err, stats) => {

Extension/src/LanguageServer/ui.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ export class UI {
187187

188188
let items: IndexableQuickPickItem[];
189189
items = [];
190-
if (this.browseEngineStatusBarItem.tooltip == "Parsing paused") {
190+
if (this.browseEngineStatusBarItem.tooltip === "Parsing paused") {
191191
items.push({ label: "Resume Parsing", description: "", index: 1 });
192192
} else {
193193
items.push({ label: "Pause Parsing", description: "", index: 0 });

Extension/src/abTesting.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const userBucketMax: number = 100;
1717
const userBucketString: string = "CPP.UserBucket";
1818

1919
export function activate(context: vscode.ExtensionContext): void {
20-
if (context.globalState.get<number>(userBucketString, -1) == -1) {
20+
if (context.globalState.get<number>(userBucketString, -1) === -1) {
2121
let bucket: number = Math.floor(Math.random() * userBucketMax) + 1; // Range is [1, userBucketMax].
2222
context.globalState.update(userBucketString, bucket);
2323
}
@@ -38,7 +38,7 @@ function downloadCpptoolsJson(urlString): Promise<void> {
3838
agent: util.GetHttpsProxyAgent(),
3939
rejectUnauthorized: vscode.workspace.getConfiguration().get("http.proxyStrictSSL", true)
4040
}, (response) => {
41-
if (response.statusCode == 301 || response.statusCode == 302) {
41+
if (response.statusCode === 301 || response.statusCode === 302) {
4242
let redirectUrl: string | string[];
4343
if (typeof response.headers.location === "string") {
4444
redirectUrl = response.headers.location;
@@ -47,7 +47,7 @@ function downloadCpptoolsJson(urlString): Promise<void> {
4747
}
4848
return resolve(downloadCpptoolsJson(redirectUrl)); // Redirect - download from new location
4949
}
50-
if (response.statusCode != 200) {
50+
if (response.statusCode !== 200) {
5151
return reject();
5252
}
5353
let downloadedBytes = 0; // tslint:disable-line
@@ -88,7 +88,7 @@ export function processCpptoolsJson(cpptoolsString: string): Promise<void> {
8888
} else {
8989
util.packageJson.contributes.configuration.properties["C_Cpp.intelliSenseEngine"].default = "Tag Parser";
9090
}
91-
if (prevIntelliSenseEngineDefault != util.packageJson.contributes.configuration.properties["C_Cpp.intelliSenseEngine"].default) {
91+
if (prevIntelliSenseEngineDefault !== util.packageJson.contributes.configuration.properties["C_Cpp.intelliSenseEngine"].default) {
9292
return util.writeFileText(util.getPackageJsonPath(), util.getPackageJsonString());
9393
}
9494
}

0 commit comments

Comments
 (0)