本文整理汇总了TypeScript中vscode.workspace类的典型用法代码示例。如果您正苦于以下问题:TypeScript workspace类的具体用法?TypeScript workspace怎么用?TypeScript workspace使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了workspace类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(exec: string) {
let configuration = vscode.workspace.getConfiguration("specflow-bsl");
this.cache = new loki("gtags.json");
this.cacheUpdates = false;
}
开发者ID:pumbaEO,项目名称:vsc-bsl-specflow,代码行数:5,代码来源:global.ts
示例2: loadConfig
function loadConfig() {
let section = vscode.workspace.getConfiguration('julia');
enableCrashReporter = section.get<boolean>('enableCrashReporter', false)
enableTelemetry = section.get<boolean>('enableTelemetry', false);
}
开发者ID:JuliaEditorSupport,项目名称:julia-vscode,代码行数:6,代码来源:telemetry.ts
示例3: test
test('issue #5362 - Incorrect TextEditor passed by onDidChangeTextEditorSelection', (done) => {
const file10Path = join(workspace.rootPath || '', './10linefile.ts');
const file30Path = join(workspace.rootPath || '', './30linefile.ts');
let finished = false;
let failOncePlease = (err: Error) => {
if (finished) {
return;
}
finished = true;
done(err);
};
let passOncePlease = () => {
if (finished) {
return;
}
finished = true;
done(null);
};
let subscription = window.onDidChangeTextEditorSelection((e) => {
let lineCount = e.textEditor.document.lineCount;
let pos1 = e.textEditor.selections[0].active.line;
let pos2 = e.selections[0].active.line;
if (pos1 !== pos2) {
failOncePlease(new Error('received invalid selection changed event!'));
return;
}
if (pos1 >= lineCount) {
failOncePlease(new Error(`Cursor position (${pos1}) is not valid in the document ${e.textEditor.document.fileName} that has ${lineCount} lines.`));
return;
}
});
// Open 10 line file, show it in slot 1, set cursor to line 10
// Open 30 line file, show it in slot 1, set cursor to line 30
// Open 10 line file, show it in slot 1
// Open 30 line file, show it in slot 1
workspace.openTextDocument(file10Path).then((doc) => {
return window.showTextDocument(doc, ViewColumn.One);
}).then((editor10line) => {
editor10line.selection = new Selection(new Position(9, 0), new Position(9, 0));
}).then(() => {
return workspace.openTextDocument(file30Path);
}).then((doc) => {
return window.showTextDocument(doc, ViewColumn.One);
}).then((editor30line) => {
editor30line.selection = new Selection(new Position(29, 0), new Position(29, 0));
}).then(() => {
return workspace.openTextDocument(file10Path);
}).then((doc) => {
return window.showTextDocument(doc, ViewColumn.One);
}).then(() => {
return workspace.openTextDocument(file30Path);
}).then((doc) => {
return window.showTextDocument(doc, ViewColumn.One);
}).then(() => {
subscription.dispose();
}).then(passOncePlease, failOncePlease);
});
开发者ID:VishalMadhvani,项目名称:vscode,代码行数:63,代码来源:window.test.ts
示例4: switch
var teims = vscode.window.showQuickPick(items).then(async (resolve: string) => {
switch (resolve) {
case items[0]: {
//extension local settings
var file: vscode.Uri = vscode.Uri.file(en.FILE_CUSTOMIZEDSETTINGS);
fs.openSync(file.fsPath, 'r');
await vscode.workspace.openTextDocument(file).then((a: vscode.TextDocument) => {
vscode.window.showTextDocument(a, vscode.ViewColumn.One, true);
});
break;
}
case items[1]: {
//share public gist
await vscode.window.showInformationMessage("Sync : This will remove current GIST and upload settings on new public GIST. Do you want to continue ?", "Yes").then((resolve) => {
if (resolve == "Yes") {
localSetting.publicGist = true;
settingChanged = true;
setting.gist = "";
selectedItem = 1;
}
}, (reject) => {
return;
});
break;
}
case items[2]: {
//toggle force download
selectedItem = 2;
settingChanged = true;
if (setting.forceDownload) {
setting.forceDownload = false;
}
else {
setting.forceDownload = true;
}
break;
}
case items[3]: {
//toggle auto upload
selectedItem = 3;
settingChanged = true;
if (setting.autoUpload) {
setting.autoUpload = false;
}
else {
setting.autoUpload = true;
}
break;
}
case items[4]: {
//auto downlaod on startup
selectedItem = 4;
settingChanged = true;
if (!setting) {
vscode.commands.executeCommand('extension.HowSettings');
return;
}
if (!tokenAvailable || !gistAvailable) {
vscode.commands.executeCommand('extension.HowSettings');
return;
}
if (setting.autoDownload) {
setting.autoDownload = false;
}
else {
setting.autoDownload = true;
}
break;
}
case items[5]: {
//page summary toggle
selectedItem = 5;
settingChanged = true;
if (!tokenAvailable || !gistAvailable) {
vscode.commands.executeCommand('extension.HowSettings');
return;
}
if (setting.showSummary) {
setting.showSummary = false;
}
else {
setting.showSummary = true;
}
break;
}
case items[6]: {
//preserve
let options: vscode.InputBoxOptions = {
ignoreFocusOut: true,
placeHolder: "Enter any Key from settings.json to preserve.",
prompt: "Example : Write 'http.proxy' => store this computer proxy and overwrite it , if set empty it will remove proxy."
};
vscode.window.showInputBox(options).then(async (res) => {
//.........这里部分代码省略.........
开发者ID:rlugojr,项目名称:code-settings-sync,代码行数:101,代码来源:extension.ts
示例5: configurationChanged
private configurationChanged(): void {
const config = vscode.workspace.getConfiguration(this.id, null);
this.updateValidate(config.get(validateSetting, true));
this.updateSuggestionDiagnostics(config.get(suggestionSetting, true));
}
开发者ID:VishalMadhvani,项目名称:vscode,代码行数:5,代码来源:languageProvider.ts
示例6: async
return serverUtils.runCodeAction(this._server, req).then(response => {
if (response && Array.isArray(response.Changes)) {
let edit = new vscode.WorkspaceEdit();
let fileToOpen: Uri = null;
let renamedFiles: Uri[] = [];
for (let change of response.Changes) {
if (change.ModificationType == FileModificationType.Renamed)
{
// The file was renamed. Omnisharp has already persisted
// the right changes to disk. We don't need to try to
// apply text changes (and will skip this file if we see an edit)
renamedFiles.push(Uri.file(change.FileName));
}
}
for (let change of response.Changes) {
if (change.ModificationType == FileModificationType.Opened)
{
// The CodeAction requested that we open a file.
// Record that file name and keep processing CodeActions.
// If a CodeAction requests that we open multiple files
// we only open the last one (what would it mean to open multiple files?)
fileToOpen = vscode.Uri.file(change.FileName);
}
if (change.ModificationType == FileModificationType.Modified)
{
let uri = vscode.Uri.file(change.FileName);
if (renamedFiles.some(r => r == uri))
{
// This file got renamed. Omnisharp has already
// persisted the new file with any applicable changes.
continue;
}
let edits: vscode.TextEdit[] = [];
for (let textChange of change.Changes) {
edits.push(vscode.TextEdit.replace(toRange2(textChange), textChange.NewText));
}
edit.set(uri, edits);
}
}
let applyEditPromise = vscode.workspace.applyEdit(edit);
// Unfortunately, the textEditor.Close() API has been deprecated
// and replaced with a command that can only close the active editor.
// If files were renamed that weren't the active editor, their tabs will
// be left open and marked as "deleted" by VS Code
let next = applyEditPromise;
if (renamedFiles.some(r => r.fsPath == vscode.window.activeTextEditor.document.uri.fsPath))
{
next = applyEditPromise.then(_ =>
{
return vscode.commands.executeCommand("workbench.action.closeActiveEditor");
});
}
return fileToOpen != null
? next.then(_ =>
{
return vscode.commands.executeCommand("vscode.open", fileToOpen);
})
: next;
}
}, async (error) => {
开发者ID:peterblazejewicz,项目名称:omnisharp-vscode,代码行数:71,代码来源:codeActionProvider.ts
示例7:
let isDecoratorEnabled = (languageId: string) => {
return workspace.getConfiguration().get<boolean>(languageId + '.colorDecorators.enable');
};
开发者ID:naturtle,项目名称:vscode,代码行数:3,代码来源:jsonMain.ts
示例8: runSilent
function runSilent() {
return workspace.getConfiguration('npm')['runSilent'];
}
开发者ID:scytalezero,项目名称:vscode-npm-scripts,代码行数:3,代码来源:main.ts
示例9: getNpmBin
function getNpmBin() {
return workspace.getConfiguration('npm')['bin'] || 'npm';
}
开发者ID:scytalezero,项目名称:vscode-npm-scripts,代码行数:3,代码来源:main.ts
示例10:
}).then(() => {
return workspace.openTextDocument(samplesFolder + expectedResultFilePath);
}).then((expectedResultDocument) => {
开发者ID:rlugojr,项目名称:vscode-htmltagwrap,代码行数:3,代码来源:extension.test.ts
注:本文中的vscode.workspace类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论