Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved.
* See 'LICENSE' in the project root for license information.
* ------------------------------------------------------------------------------------------ */
'use strict';
import * as vscode from 'vscode';
import { DefaultClient, RenameParams, FindAllReferencesParams } from './client';
import { FindAllRefsView } from './referencesView';
import * as telemetry from '../telemetry';
import * as nls from 'vscode-nls';
import { RenameView } from './renameView';
import * as logger from '../logger';
import { PersistentState } from './persistentState';
nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })();
const localize: nls.LocalizeFunc = nls.loadMessageBundle();
export enum ReferenceType {
Confirmed,
ConfirmationInProgress,
Comment,
String,
Inactive,
CannotConfirm,
NotAReference
}
export interface ReferenceInfo {
file: string;
position: vscode.Position;
text: string;
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved.
* See 'LICENSE' in the project root for license information.
* ------------------------------------------------------------------------------------------ */
'use strict';
import * as vscode from 'vscode';
import * as util from '../common';
import { ReferencesModel, TreeNode, NodeType } from './referencesModel';
import { ReferenceType, getReferenceTagString } from './references';
import * as nls from 'vscode-nls';
nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })();
const localize: nls.LocalizeFunc = nls.loadMessageBundle();
export function getReferenceTypeIconPath(referenceType: ReferenceType): { light: string; dark: string } {
const assetsFolder: string = "assets/";
const postFixLight: string = "-light.svg";
const postFixDark: string = "-dark.svg";
let basePath: string = "ref-cannot-confirm";
switch (referenceType) {
case ReferenceType.Confirmed: basePath = "ref-confirmed"; break;
case ReferenceType.Comment: basePath = "ref-comment"; break;
case ReferenceType.String: basePath = "ref-string"; break;
case ReferenceType.Inactive: basePath = "ref-inactive"; break;
case ReferenceType.CannotConfirm: basePath = "ref-cannot-confirm"; break;
case ReferenceType.NotAReference: basePath = "ref-not-a-reference"; break;
case ReferenceType.ConfirmationInProgress: basePath = "ref-confirmation-in-progress"; break;
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved.
* See 'LICENSE' in the project root for license information.
* ------------------------------------------------------------------------------------------ */
import * as util from '../common';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })();
const localize: nls.LocalizeFunc = nls.loadMessageBundle();
class RefreshButton implements vscode.QuickInputButton {
get iconPath(): { dark: vscode.Uri; light: vscode.Uri } {
const refreshImagePathDark: string = util.getExtensionFilePath("assets/Refresh_inverse.svg");
const refreshImagePathLight: string = util.getExtensionFilePath("assets/Refresh.svg");
return {
dark: vscode.Uri.file(refreshImagePathDark),
light: vscode.Uri.file(refreshImagePathLight)
};
}
get tooltip(): string {
return localize("refresh.process.list.tooltip", "Refresh process list");
}
* This module uses the [vscode-cpptools API](https://www.npmjs.com/package/vscode-cpptools)
* to provide that extension with per-file configuration information.
*/ /** */
import {CMakeCache} from '@cmt/cache';
import * as cms from '@cmt/drivers/cms-client';
import {createLogger} from '@cmt/logging';
import rollbar from '@cmt/rollbar';
import * as shlex from '@cmt/shlex';
import * as util from '@cmt/util';
import * as path from 'path';
import * as vscode from 'vscode';
import * as cpt from 'vscode-cpptools';
import * as nls from 'vscode-nls';
nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })();
const localize: nls.LocalizeFunc = nls.loadMessageBundle();
const log = createLogger('cpptools');
type StandardVersion = 'c89'|'c99'|'c11'|'c++98'|'c++03'|'c++11'|'c++14'|'c++17'|'c++20';
export interface CompileFlagInformation {
extraDefinitions: string[];
standard: StandardVersion;
}
class MissingCompilerException extends Error {}
interface TargetDefaults {
includePath: string[];
compileFlags: string[];
/**
* Wrappers and utilities around the NodeJS `child_process` module.
*/ /** */
import * as proc from 'child_process';
import * as iconv from 'iconv-lite';
import {createLogger} from './logging';
import rollbar from './rollbar';
import * as util from './util';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })();
const localize: nls.LocalizeFunc = nls.loadMessageBundle();
const log = createLogger('proc');
export interface ExecutionResult {
retc: number|null;
stdout: string;
stderr: string;
}
/**
* Return value for items that have progress information
*/
export interface ProgressData {
/**
findCLCompilerPath,
effectiveKitEnvironment,
OLD_USER_KITS_FILEPATH,
} from '@cmt/kit';
import {fs} from '@cmt/pr';
import {MultiWatcher} from '@cmt/watcher';
import {ConfigurationReader} from '@cmt/config';
import paths from '@cmt/paths';
import {Strand} from '@cmt/strand';
import {StatusBar} from './status';
import {FireNow} from '@cmt/prop';
import {ProjectOutlineProvider, TargetNode, SourceFileNode} from '@cmt/tree';
import {ProgressHandle, DummyDisposable} from './util';
import * as nls from 'vscode-nls';
nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })();
const localize: nls.LocalizeFunc = nls.loadMessageBundle();
const log = logging.createLogger('extension');
function reportProgress(progress: ProgressHandle|undefined, message: string) {
if (progress) {
progress.report({message});
}
}
/**
* A class to manage the extension.
*
* Yeah, yeah. It's another "Manager", but this is to be the only one.
*
* This is the true "singleton" of the extension. It acts as the glue between
import * as child_process from 'child_process';
import * as path from 'path';
import * as vscode from 'vscode';
import * as fs from 'fs';
import {EnvironmentVariables, execute} from './proc';
import * as nls from 'vscode-nls';
nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })();
const localize: nls.LocalizeFunc = nls.loadMessageBundle();
/**
* Escape a string so it can be used as a regular expression
*/
export function escapeStringForRegex(str: string): string { return str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, '\\$1'); }
/**
* Replace all occurrences of `needle` in `str` with `what`
* @param str The input string
* @param needle The search string
* @param what The value to insert in place of `needle`
* @returns The modified string
*/
export function replaceAll(str: string, needle: string, what: string) {
const pattern = escapeStringForRegex(needle);
import rollbar from '@cmt/rollbar';
import * as util from '@cmt/util';
import * as json5 from 'json5';
import * as path from 'path';
import * as vscode from 'vscode';
import * as expand from './expand';
import * as logging from './logging';
import paths from './paths';
import {fs} from './pr';
import * as proc from './proc';
import {loadSchema} from './schema';
import {compare, dropNulls, objectPairs, Ordering, thisExtensionPath} from './util';
import * as nls from 'vscode-nls';
nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })();
const localize: nls.LocalizeFunc = nls.loadMessageBundle();
const log = logging.createLogger('kit');
type ProgressReporter = vscode.Progress<{message?: string}>;
/**
* Cache the results of invoking 'vswhere'
*/
interface VSInstallationCache {
installations: VSInstallation[];
queryTime: number;
}
let cachedVSInstallations: VSInstallationCache|null = null;
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as fs from 'fs';
import * as nls from 'vscode-nls';
nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })();
const localize: nls.LocalizeFunc = nls.loadMessageBundle();
export interface Environment {
name: string;
value: string;
}
export class ParsedEnvironmentFile {
public Env: Environment[];
public Warning: string | null;
private constructor(env: Environment[], warning: string | null) {
this.Env = env;
this.Warning = warning;
}
import { getLanguageConfig } from './languageConfig';
import { getCustomConfigProviders } from './customProviders';
import { PlatformInformation } from '../platform';
import { Range } from 'vscode-languageclient';
import { ChildProcess, spawn, execSync } from 'child_process';
import * as tmp from 'tmp';
import { getTargetBuildInfo, BuildInfo } from '../githubAPI';
import * as configs from './configurations';
import { PackageVersion } from '../packageVersion';
import { getTemporaryCommandRegistrarInstance } from '../commands';
import * as rd from 'readline';
import * as yauzl from 'yauzl';
import { Readable } from 'stream';
import * as nls from 'vscode-nls';
nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })();
const localize: nls.LocalizeFunc = nls.loadMessageBundle();
let prevCrashFile: string;
let clients: ClientCollection;
let activeDocument: string;
let ui: UI;
let disposables: vscode.Disposable[] = [];
let languageConfigurations: vscode.Disposable[] = [];
let intervalTimer: NodeJS.Timer;
let insiderUpdateTimer: NodeJS.Timer;
let realActivationOccurred: boolean = false;
let tempCommands: vscode.Disposable[] = [];
let activatedPreviously: PersistentWorkspaceState;
const insiderUpdateTimerInterval: number = 1000 * 60 * 60;
let buildInfoCache: BuildInfo | null = null;
const taskSourceStr: string = "C/C++";