示例#1
0
文件: cellHelper.js 项目: d0f/.vscode
 advanceToCell(document, range) {
     if (!range || !document) {
         return;
     }
     const textEditor = vscode.window.visibleTextEditors.find(editor => editor.document && editor.document.fileName === document.fileName);
     if (!textEditor) {
         return;
     }
     // Remember, we use comments to identify cells
     // Setting the cursor to the comment doesn't make sense
     // Quirk 1: Besides the document highlighter doesn't kick in (event' not fired), when you have placed the cursor on a comment
     // Quirk 2: If the first character starts with a %, then for some reason the highlighter doesn't kick in (event' not fired)
     let firstLineOfCellRange = range;
     if (range.start.line < range.end.line) {
         // let line = textEditor.document.lineAt(range.start.line + 1);
         // let start = new vscode.Position(range.start.line + 1, range.start.character);
         // firstLineOfCellRange = new vscode.Range(start, range.end);
         const start = CellHelper.findStartPositionWithCode(document, range.start.line + 1, range.end.line);
         firstLineOfCellRange = new vscode.Range(start, range.end);
     }
     textEditor.selections = [];
     textEditor.selection = new vscode.Selection(firstLineOfCellRange.start, firstLineOfCellRange.start);
     textEditor.revealRange(range);
     vscode.window.showTextDocument(textEditor.document);
 }
 vscode.window.visibleTextEditors.forEach(function (editor, index, array) {
     if (editor.document == document) {
         if (!foundEditor) {
             foundEditor = true;
             vscode.window.showTextDocument(document, editor.viewColumn);
         }
     }
 });
示例#3
0
     .then(doc => {
     if (!doc) {
         return false;
     }
     return vscode_1.window.showTextDocument(doc, vscode_1.window.activeTextEditor ?
         vscode_1.window.activeTextEditor.viewColumn : undefined)
         .then(editor => !!editor);
 }, () => false)
示例#4
0
 p.on('exit', (code, _signal) => __awaiter(this, void 0, void 0, function* () {
     if (code === 0) {
         let document = yield vscode_1.workspace.openTextDocument(tslintConfigFile);
         vscode_1.window.showTextDocument(document);
     }
     else {
         vscode_1.window.showErrorMessage('Could not run `tslint` to generate a configuration file. Please verify that you have `tslint` and `typescript` installed.');
     }
 }));
                        vscode.workspace.openTextDocument(consoleLogFile).then(function(d) {
                            vscode.window.showTextDocument(d);
                            // Open file, add console string, save file.
                            var fd = fs.openSync(path + fileName + ".vscodeLog", 'w+');
                            var buffer = new Buffer(String(data));
                            fs.writeSync(fd, buffer, 0, buffer.length);
                            fs.close(fd);

                        });
 vscode.workspace.openTextDocument(targetFileName).then(function (document) {
     var foundEditor = false;
     vscode.window.visibleTextEditors.forEach(function (editor, index, array) {
         if (editor.document == document) {
             if (!foundEditor) {
                 foundEditor = true;
                 vscode.window.showTextDocument(document, editor.viewColumn);
             }
         }
     });
     if (!foundEditor) {
         if (vscode.window.activeTextEditor != undefined) {
             vscode.window.showTextDocument(document, vscode.window.activeTextEditor.viewColumn);
         }
         else {
             vscode.window.showTextDocument(document);
         }
     }
 });
示例#7
0
文件: commands.js 项目: d0f/.vscode
 return __awaiter(this, void 0, void 0, function* () {
     try {
         if (!pinned)
             return yield vscode_1.commands.executeCommand(constants_1.BuiltInCommands.Open, uri);
         const document = yield vscode_1.workspace.openTextDocument(uri);
         return vscode_1.window.showTextDocument(document, (vscode_1.window.activeTextEditor && vscode_1.window.activeTextEditor.viewColumn) || 1, true);
     }
     catch (ex) {
         return undefined;
     }
 });
示例#8
0
function showSource(mdUri) {
    if (!mdUri) {
        return vscode_1.commands.executeCommand('workbench.action.navigateBack');
    }
    var docUri = vscode_1.Uri.parse(mdUri.query);
    for (var _i = 0, _a = vscode_1.window.visibleTextEditors; _i < _a.length; _i++) {
        var editor = _a[_i];
        if (editor.document.uri.toString() === docUri.toString()) {
            return vscode_1.window.showTextDocument(editor.document, editor.viewColumn);
        }
    }
    return vscode_1.workspace.openTextDocument(docUri).then(function (doc) {
        return vscode_1.window.showTextDocument(doc);
    });
}
function openOrShowLocation(location) {
  var lastEditEditorFound = vscode.workspace.textDocuments.find(function(item) {
    return item.fileName === location.file;
  });
  if (lastEditEditorFound) {
    vscode.window.showTextDocument(lastEditEditorFound).then(function(editor) {
      scrollToLocation(editor, location);
    });
  } else {
    vscode.workspace
      .openTextDocument(location.file)
      .then(vscode.window.showTextDocument)
      .then(function(editor) {
        scrollToLocation(editor, location);
      });
  }
}
示例#10
0
		prepareSyncDocument.then(function(document) {
			var showSyncDocument = vscode.window.showTextDocument(document);
			showSyncDocument.then(function() {
				var edit = vscode.window.activeTextEditor.edit(function(editBuilder) {
					editBuilder.delete(new vscode.Range(
						new vscode.Position(0,0),
						new vscode.Position(Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER)
					));
				});
				edit.then(function () {
					vscode.window.activeTextEditor.edit(function (editBuilder) {
						editBuilder.insert(new vscode.Position(0, 0), syncJson);
					});
				});
				vscode.window.activeTextEditor.document.syncOptions = options;
			}, function(err) {
            vscode.window.showErrorMessage("Ftp-sync: sync error: " + err)
            })
		}, function(err) {
示例#11
0
 return __awaiter(this, void 0, void 0, function* () {
     let folders = vscode_1.workspace.workspaceFolders;
     let folder = undefined;
     if (!folders) {
         vscode_1.window.showErrorMessage('A TSLint configuration file can only be generated if VS Code is opened on a folder.');
         return;
     }
     if (folders.length === 1) {
         folder = folders[0];
     }
     else {
         const options = {
             placeHolder: "Select the folder for generating the 'tslint.json' file"
         };
         folder = yield vscode_1.window.showWorkspaceFolderPick(options);
         if (!folder) {
             return;
         }
     }
     const folderPath = folder.uri.fsPath;
     const tslintConfigFile = path.join(folderPath, 'tslint.json');
     if (fs.existsSync(tslintConfigFile)) {
         vscode_1.window.showInformationMessage('A TSLint configuration file already exists.');
         let document = yield vscode_1.workspace.openTextDocument(tslintConfigFile);
         vscode_1.window.showTextDocument(document);
     }
     else {
         const tslintCmd = yield findTslint(folderPath);
         const cmd = `${tslintCmd} --init`;
         const p = child_process_1.exec(cmd, { cwd: folderPath, env: process.env });
         p.on('exit', (code, _signal) => __awaiter(this, void 0, void 0, function* () {
             if (code === 0) {
                 let document = yield vscode_1.workspace.openTextDocument(tslintConfigFile);
                 vscode_1.window.showTextDocument(document);
             }
             else {
                 vscode_1.window.showErrorMessage('Could not run `tslint` to generate a configuration file. Please verify that you have `tslint` and `typescript` installed.');
             }
         }));
     }
 });
示例#12
0
async function configure(actionContext, rootFolderPath) {
    if (!rootFolderPath) {
        let folder = await quickPickWorkspaceFolder_1.quickPickWorkspaceFolder('To generate Docker files you must first open a folder or workspace in VS Code.');
        rootFolderPath = folder.uri.fsPath;
    }
    let filesWritten = await configureCore(actionContext, {
        rootPath: rootFolderPath,
        outputFolder: rootFolderPath,
        openDockerFile: true
    });
    // Open the dockerfile (if written)
    try {
        let dockerfile = filesWritten.find(fp => path.basename(fp).toLowerCase() === 'dockerfile');
        if (dockerfile) {
            await vscode.window.showTextDocument(vscode.Uri.file(dockerfile));
        }
    }
    catch (err) {
        // Ignore
    }
}
示例#13
0
文件: extension.js 项目: d0f/.vscode
 vscode.workspace.openTextDocument(getProjectFilePath()).then(function (doc) {
     vscode.window.showTextDocument(doc);
 });
示例#14
0
    vscode.workspace.openTextDocument(ftpconfig.getConfigPath()).then(document => {
			vscode.window.showTextDocument(document);
    });
示例#15
0
 vscode.workspace.openTextDocument(path.join(dir, file)).then(document => {
     vscode.window.showTextDocument(document);
 });
示例#16
0
 vscode.workspace.openTextDocument(configUri).then( function(document) {vscode.window.showTextDocument(document)});
示例#17
0
	configDocument.then(function(document) {
		vscode.window.showTextDocument(document);
	});
示例#18
0
     .then(function () {
     vscode_1.window.showTextDocument(activeTextEditor.document, activeTextEditor.viewColumn);
     activeTextEditor.selection = new vscode_1.Selection(activeTextEditor.selection.start, activeTextEditor.selection.start);
     return Promise.resolve(true);
 });
示例#19
0
 vscode.workspace.openTextDocument(tmpFilePath).then(function (d) {
     vscode.window.showTextDocument(d);
     resolve(tmpFilePath);
 });
示例#20
0
 vscode.workspace.openTextDocument(filePath_1).then(function (document) {
     vscode.window.showTextDocument(document);
 });
示例#21
0
 showTextDocument(uri, options, preserveFocus) {
     return vscode_1.window.showTextDocument(uri, options, preserveFocus);
 }
示例#22
0
文件: extension.js 项目: d0f/.vscode
 vscode.workspace.openTextDocument(nextDocument.toString()).then(function (doc) {
     vscode.window.showTextDocument(doc).then(function (editor) {
         // revealLine(activeBookmark.bookmarks[0]);
         revealLine(bookmarks.activeBookmark.bookmarks[bookmarks.activeBookmark.bookmarks.length - 1]);
     });
 });
示例#23
0
文件: extension.js 项目: d0f/.vscode
 vscode.workspace.openTextDocument(uriDocument).then(function (doc) {
     vscode.window.showTextDocument(doc, undefined, true).then(function (editor) {
         revealLine(parseInt(item.label, 10) - 1);
     });
 });
示例#24
0
文件: extension.js 项目: d0f/.vscode
 vscode.workspace.openTextDocument(uriDocument).then(function (doc) {
     vscode.window.showTextDocument(doc).then(function (editor) {
         revealLine(currentLine - 1);
         return;
     });
 });
示例#25
0
 vscode.workspace.openTextDocument(p).then(function (doc) {
   vscode.window.showTextDocument(doc, column).then(function(){
     if(cb) cb();
   });
 });
示例#26
0
文件: logcat.js 项目: agrabhi/logcat
 vscode.workspace.openTextDocument(filePath).then(doc => {
     vscode.window.showTextDocument(doc).then(
         postDocOpenFn
         , reason => { console.log(reason); }
     );
 }, reason => { console.log(reason); }
示例#27
0
 vscode.workspace.openTextDocument(this.propertiesFile).then(function (document) {
     vscode.window.showTextDocument(document);
 });
示例#28
0
 return __awaiter(this, void 0, void 0, function* () {
     const imageName = image.RepoTags ? image.RepoTags[0] : image.Id;
     const uri = vscode_1.Uri.parse(`${exports.SCHEME}://${exports.IMAGE_DOMAIN}/${imageName}${exports.URI_EXTENSION}`);
     vscode_1.window.showTextDocument(yield vscode_1.workspace.openTextDocument(uri));
 });
			vscode.workspace.openTextDocument(tmpFile).then(d => {
				vscode.window.showTextDocument(d);
				vscode.commands.executeCommand("workbench.files.action.compareFileWith");
				vscode.window.showTextDocument(doc);
				resolve(p4uri);
			}, (reason) => {console.log(reason);});
示例#30
0
文件: extension.js 项目: d0f/.vscode
 vscode.workspace.openTextDocument(uriDocument).then(function (doc) {
     vscode.window.showTextDocument(doc).then(function (editor) {
         revealLine(parseInt(selection.label, 10) - 1);
     });
 });