示例#1
1
文件: file.js 项目: cjxgm/etc
 return __awaiter(this, void 0, void 0, function* () {
     if (!this._arguments.name) {
         // Open an empty file
         if (this._arguments.position === FilePosition.CurrentWindow) {
             yield vscode.commands.executeCommand("workbench.action.files.newUntitledFile");
         }
         else {
             yield vscode.commands.executeCommand("workbench.action.splitEditor");
         }
         return;
     }
     let currentFilePath = vscode.window.activeTextEditor.document.uri.path;
     let newFilePath = path.isAbsolute(this._arguments.name) ?
         this._arguments.name :
         path.join(path.dirname(currentFilePath), this._arguments.name);
     if (newFilePath !== currentFilePath) {
         const newFileDoesntExist = !(yield this.fileExists(newFilePath));
         const newFileHasNoExtname = path.extname(newFilePath) === '';
         if (newFileDoesntExist && newFileHasNoExtname) {
             const pathWithExtname = newFilePath + path.extname(currentFilePath);
             if (yield this.fileExists(pathWithExtname)) {
                 newFilePath = pathWithExtname;
             }
         }
         let folder = vscode.Uri.file(newFilePath);
         yield vscode.commands.executeCommand("vscode.open", folder, this._arguments.position === FilePosition.NewWindow ? this.getViewColumnToRight() : this.getActiveViewColumn());
     }
 });
// this method is called when your extension is activated
// your extension is activated the very first time the command is executed
function activate(context) {
	
	var syncHelper, currentConfig;
	var ftpConfig = require('./modules/ftp-config');
	
	var getSyncHelper = function() {
		var oldConfig = currentConfig;
		currentConfig = ftpConfig.getSyncConfig();
		
		if(!syncHelper)
			syncHelper = require('./modules/sync-helper')();
		else if(ftpConfig.connectionChanged(oldConfig)) 
			syncHelper.disconnect();
		
		syncHelper.useConfig(currentConfig)
		
		return syncHelper;
	}
	
	var initCommand = vscode.commands.registerCommand('extension.ftpsyncinit', require('./modules/init-command'));
	var syncCommand = vscode.commands.registerCommand('extension.ftpsyncupload', function() { require('./modules/sync-command')(true, getSyncHelper) });
	var downloadCommand = vscode.commands.registerCommand('extension.ftpsyncdownload', function() { require('./modules/sync-command')(false, getSyncHelper) });
	var commitCommand = vscode.commands.registerCommand('extension.ftpsynccommit', function() { require('./modules/commit-command')(getSyncHelper) });
	
	var onSave = require('./modules/on-save');
	vscode.workspace.onDidSaveTextDocument(function(file) {
		onSave(file, getSyncHelper);
	});
	
	
	context.subscriptions.push(initCommand);
	context.subscriptions.push(syncCommand);
	context.subscriptions.push(downloadCommand);
	context.subscriptions.push(commitCommand);
}
示例#3
0
 return __awaiter(this, void 0, void 0, function* () {
     if (!(uri instanceof vscode_1.Uri)) {
         uri = editor && editor.document && editor.document.uri;
     }
     if (!uri) {
         return vscode_1.commands.executeCommand(commands_1.Commands.ShowQuickRepoHistory);
     }
     const gitUri = yield gitProvider_1.GitUri.fromUri(uri, this.git);
     if (maxCount == null) {
         maxCount = this.git.config.advanced.maxQuickHistory;
     }
     try {
         const log = yield this.git.getLogForFile(gitUri.fsPath, gitUri.sha, gitUri.repoPath, undefined, maxCount);
         if (!log)
             return vscode_1.window.showWarningMessage(`Unable to show file history. File is probably not under source control`);
         let pick = yield quickPicks_1.FileHistoryQuickPick.show(log, uri, gitUri.sha, maxCount, this.git.config.advanced.maxQuickHistory, goBackCommand);
         if (!pick)
             return undefined;
         if (pick instanceof quickPicks_1.CommandQuickPickItem) {
             return pick.execute();
         }
         return vscode_1.commands.executeCommand(commands_1.Commands.ShowQuickCommitFileDetails, new gitProvider_1.GitUri(pick.commit.uri, pick.commit), pick.commit.sha, pick.commit, new quickPicks_1.CommandQuickPickItem({
             label: `go back \u21A9`,
             description: `\u00a0 \u2014 \u00a0\u00a0 to history of \u00a0$(file-text) ${path.basename(pick.commit.fileName)}`
         }, commands_1.Commands.ShowQuickFileHistory, [uri, maxCount, goBackCommand]), { showFileHistory: false });
     }
     catch (ex) {
         logger_1.Logger.error('[GitLens.ShowQuickFileHistoryCommand]', 'getLogLocations', ex);
         return vscode_1.window.showErrorMessage(`Unable to show file history. See output channel for more details`);
     }
 });
示例#4
0
function activate(context) {

  console.log('Extension "AutoBuildMarlin" is now active!');

  var NEXT_TERM_ID = 1;
  var pio_build     = vscode.commands.registerCommand('piobuild',     function () {
    const terminal = vscode.window.createTerminal(`#${NEXT_TERM_ID++}`);
    terminal.sendText("python buildroot/share/atom/auto_build.py build");
    });
  var pio_clean     = vscode.commands.registerCommand('pioclean',     function () {
    const terminal = vscode.window.createTerminal(`#${NEXT_TERM_ID++}`);
    terminal.sendText("python buildroot/share/atom/auto_build.py clean");
  });
  var pio_upload    = vscode.commands.registerCommand('pioupload',    function () {
    const terminal = vscode.window.createTerminal(`#${NEXT_TERM_ID++}`);
    terminal.sendText("python buildroot/share/atom/auto_build.py upload");
  });
  var pio_traceback = vscode.commands.registerCommand('piotraceback', function () {
    const terminal = vscode.window.createTerminal(`#${NEXT_TERM_ID++}`);
    terminal.sendText("python buildroot/share/atom/auto_build.py traceback");
  });

  context.subscriptions.push(pio_build);
  context.subscriptions.push(pio_clean);
  context.subscriptions.push(pio_upload);
  context.subscriptions.push(pio_traceback);
}
示例#5
0
 return __awaiter(this, void 0, void 0, function* () {
     yield editor.edit(textEditor => {
         textEditor.insert(new vscode.Position(lineNumber, lineLength), `\n${indentationFor(lineText)}end`);
     });
     yield vscode.commands.executeCommand("cursorUp");
     vscode.commands.executeCommand("editor.action.insertLineAfter");
 });
示例#6
0
 return __awaiter(this, void 0, void 0, function* () {
     const config = vscode_1.workspace.getConfiguration();
     const installationType = check_installation_1.default();
     const releaseNotesView = new ReleaseNotes_1.ReleaseNotesWebview(context);
     write_changelog_1.default();
     // Listen on set theme: when the theme is Material Theme, just adjust icon and accent.
     vscode_1.workspace.onDidChangeConfiguration(configuration_change_1.onChangeConfiguration);
     // Delete old configuration, must remove with next major release
     if (config.has('materialTheme.cache.workbench')) {
         config.update('materialTheme.cache.workbench', undefined, true);
     }
     if (installationType.isFirstInstall) {
         const enableAutoApply = yield messages_1.installationMessage();
         yield settings_1.setCustomSetting('autoApplyIcons', enableAutoApply);
         // Set true always on new installation
         yield settings_1.setCustomSetting('showReloadNotification', true);
     }
     const shouldShowChangelog = (installationType.isFirstInstall || installationType.isUpdate) && (yield messages_1.changelogMessage());
     if (shouldShowChangelog) {
         releaseNotesView.show();
     }
     // Registering commands
     vscode_1.commands.registerCommand('materialTheme.setAccent', () => __awaiter(this, void 0, void 0, function* () {
         const accentPicked = yield ThemeCommands.accentsQuickPick();
         yield settings_1.updateAccent(accentPicked);
     }));
     vscode_1.commands.registerCommand('materialTheme.fixIcons', () => ThemeCommands.fixIcons());
     vscode_1.commands.registerCommand('materialTheme.toggleApplyIcons', () => ThemeCommands.toggleApplyIcons());
     vscode_1.commands.registerCommand('materialTheme.showReleaseNotes', () => releaseNotesView.show());
 });
示例#7
0
exports.activate = (context) => {
  let sub = context.subscriptions;
  sub.push(vscode.commands.registerCommand('HookyQR.beautify', formatActiveDocument.bind(0, true)));
  sub.push(vscode.commands.registerCommand('HookyQR.beautifyFile', formatActiveDocument.bind(0, false)));
  sub.push(vscode.workspace.onDidChangeConfiguration(formatters.configure.bind(formatters)));
  sub.push(vscode.workspace.onDidOpenTextDocument(formatters.onFileOpen.bind(formatters)));
};
示例#8
0
// this method is called when your extension is activated
// your extension is activated the very first time the command is executed
function activate(context) {
    var outChannel = vscode.window.createOutputChannel('Git');
    history.activate(outChannel);
    var disposable = vscode.commands.registerCommand('git.viewFileHistory', function (fileUri) {
        outChannel.clear();
        var fileName = '';
        if (fileUri && fileUri.fsPath) {
            fileName = fileUri.fsPath;
        }
        else {
            if (!vscode.window.activeTextEditor || !vscode.window.activeTextEditor.document) {
                return;
            }
            fileName = vscode.window.activeTextEditor.document.fileName;
        }
        history.run(fileName);
    });
    context.subscriptions.push(disposable);
    disposable = vscode.commands.registerTextEditorCommand('git.viewLineHistory', function () {
        outChannel.clear();
        lineHistory.run(outChannel);
    });
    context.subscriptions.push(disposable);
    viewer.activate(context, outChannel);
}
示例#9
0
文件: commands.js 项目: d0f/.vscode
     _editor.document.languageId + "."), openGlobalSettingsItem, openWorkspaceSettingsItem).then(function (selectedItem) {
     if (selectedItem === openGlobalSettingsItem) {
         vscode.commands.executeCommand("workbench.action.openGlobalSettings");
     }
     else if (selectedItem === openWorkspaceSettingsItem) {
         vscode.commands.executeCommand("workbench.action.openWorkspaceSettings");
     }
 });
示例#10
0
// this method is called when your extension is activated
// your extension is activated the very first time the command is executed
function activate(context) {

  // Use the console to output diagnostic information (console.log) and errors (console.error)
  // This line of code will only be executed once when your extension is activated
  // console.log('Congratulations, your extension "vscode-ipaddress" is now active!');

  const statusBarItem = new IPAddressStatusBarItem(networkInterfaces);

  context.subscriptions.push(statusBarItem);

  // The command has been defined in the package.json file
  // Now provide the implementation of the command with  registerCommand
  // The commandId parameter must match the command field in package.json
  context.subscriptions.push(
    vscode.commands.registerTextEditorCommand(Commands.INSERT_IP_ADDRESS, textEditor => {
      // The code you place here will be executed every time your command is executed

      networkInterfaces.all().then(entries => {
        vscode.window.showQuickPick(
          entries
            .map(entry => ({
              address    : entry.get('address'),
              description: `${ entry.get('interfaceName') } (${ entry.get('family') })`,
              label      : entry.get('address')
            }))
            .valueSeq()
            .toJS(),
          {
            matchOnDescription: true,
            matchOnDetail: true
          }
        ).then(entry => {
          if (!entry) { return; }

          const address = entry.address;

          textEditor.edit(edit => {
            textEditor.selections.map(selection => {
              const { start, end } = selection;

              if (start.line === end.line && start.character === end.character) {
                edit.insert(start, address);
              } else {
                edit.replace(selection, address);
              }
            });
          });
        });
      });
    })
  );

  context.subscriptions.push(
    vscode.commands.registerCommand(Commands.SHOW_NEXT_IP_ADDRESS, () => {
      statusBarItem.nextAddress();
    })
  );
}
示例#11
0
文件: Extension.js 项目: d0f/.vscode
function activate(ctx) {
    console.log('activate extension');
    exports.GlobalState = ctx.globalState;
    exports.WorkspaceState = ctx.workspaceState;
    ctx.subscriptions.push(vsc.commands.registerTextEditorCommand('xmlTools.minifyXml', Commands_1.TextEditorCommands.minifyXml), vsc.commands.registerTextEditorCommand('xmlTools.evaluateXPath', Commands_1.TextEditorCommands.evaluateXPath), vsc.commands.registerTextEditorCommand('xmlTools.executeXQuery', Commands_1.TextEditorCommands.executeXQuery), vsc.commands.registerTextEditorCommand('xmlTools.viewXmlTree', Commands_1.TextEditorCommands.viewXmlTree));
    ctx.subscriptions.push(vsc.languages.registerDocumentFormattingEditProvider([LANG_XML, LANG_XSL], new Formatting_1.XmlFormattingEditProvider()), vsc.languages.registerDocumentRangeFormattingEditProvider([LANG_XML, LANG_XSL], new Formatting_1.XmlFormattingEditProvider()), vsc.languages.registerCompletionItemProvider(LANG_XQUERY, new Completion_1.XQueryCompletionItemProvider(), ':', '$'));
    ctx.subscriptions.push(vsc.workspace.registerTextDocumentContentProvider(Content_1.XmlTreeDocumentContentProvider.SCHEME, new Content_1.XmlTreeDocumentContentProvider()));
    ctx.subscriptions.push(vsc.window.onDidChangeActiveTextEditor(_handleChangeActiveTextEditor), vsc.window.onDidChangeTextEditorSelection(_handleChangeTextEditorSelection));
}
示例#12
0
文件: extension.js 项目: cjxgm/etc
function activate(context) {
    var attachItemsProvider = nativeAttach_1.NativeAttachItemsProviderFactory.Get();
    var attacher = new attachToProcess_1.AttachPicker(attachItemsProvider);
    var disposable = vscode.commands.registerCommand('extension.pickNativeProcess', function () { return attacher.ShowAttachEntries(); });
    context.subscriptions.push(disposable);
    var remoteAttacher = new attachToProcess_1.RemoteAttachPicker();
    var disposable2 = vscode.commands.registerCommand('extension.pickRemoteNativeProcess', function (any) { return remoteAttacher.ShowAttachEntries(any); });
    context.subscriptions.push(disposable2);
}
示例#13
0
 const checkForAcceptSelectedSuggestion = vscode.commands.registerCommand("endwise.checkForAcceptSelectedSuggestion", () => __awaiter(this, void 0, void 0, function* () {
     const config = vscode.workspace.getConfiguration();
     const suggestionOnEnter = config.get("editor.acceptSuggestionOnEnter");
     if (suggestionOnEnter !== "off") {
         yield vscode.commands.executeCommand("acceptSelectedSuggestion");
     }
     else {
         yield vscode.commands.executeCommand("endwise.enter");
     }
 }));
示例#14
0
 return __awaiter(this, void 0, void 0, function* () {
     if (vscode_1.workspace.workspaceFolders) {
         const app = new blame_1.GitBlame();
         const blameCommand = vscode_1.commands.registerCommand("gitblame.quickInfo", app.showMessage, app);
         const linkCommand = vscode_1.commands.registerCommand("gitblame.online", app.blameLink, app);
         const copyHashCommand = vscode_1.commands.registerCommand("gitblame.addCommitHashToClipboard", app.copyHash, app);
         const copyToolUrl = vscode_1.commands.registerCommand("gitblame.addToolUrlToClipboard", app.copyToolUrl, app);
         context.subscriptions.push(app, blameCommand, linkCommand, copyHashCommand, copyToolUrl);
     }
 });
示例#15
0
 const disposable = vscode.commands.registerCommand(command, (args) => __awaiter(this, void 0, void 0, function* () {
     if (configuration_1.configuration.disableExtension) {
         return vscode.commands.executeCommand('default:' + command, args);
     }
     if (!vscode.window.activeTextEditor) {
         return;
     }
     if (vscode.window.activeTextEditor.document &&
         vscode.window.activeTextEditor.document.uri.toString() === 'debug:input') {
         return vscode.commands.executeCommand('default:' + command, args);
     }
     return callback(args);
 }));
示例#16
0
 return __awaiter(this, void 0, void 0, function* () {
     if (this.activeTextEditor.document.isDirty && !this.arguments.bang) {
         throw error.VimError.fromCode(error.ErrorCode.E37);
     }
     if (vscode.window.visibleTextEditors.length === 1) {
         throw error.VimError.fromCode(error.ErrorCode.E444);
     }
     let oldViewColumn = this.activeTextEditor.viewColumn;
     yield vscode.commands.executeCommand('workbench.action.closeActiveEditor');
     if (vscode.window.activeTextEditor !== undefined && vscode.window.activeTextEditor.viewColumn === oldViewColumn) {
         yield vscode.commands.executeCommand('workbench.action.previousEditor');
     }
 });
示例#17
0
文件: main.js 项目: d0f/.vscode
 registerKernelCommands() {
     this.disposables.push(vscode.commands.registerCommand(constants_1.Commands.Jupyter.Kernel.Kernel_Interrupt, () => {
         this.kernel.interrupt();
     }));
     this.disposables.push(vscode.commands.registerCommand(constants_1.Commands.Jupyter.Kernel.Kernel_Restart, () => {
         this.kernelManager.restartRunningKernelFor(this.kernel.kernelSpec.language).then(kernel => {
             this.onKernelChanged(kernel);
         });
     }));
     this.disposables.push(vscode.commands.registerCommand(constants_1.Commands.Jupyter.Kernel.Kernel_Shut_Down, () => {
         this.kernelManager.destroyRunningKernelFor('python');
         this.onKernelChanged();
     }));
 }
示例#18
0
o.hide = function(){
  if(vscode.window.activeTextEditor)
  {
    try{
      vscode.window.activeTextEditor.hide();
    }catch(e){
      vscode.commands.executeCommand("workbench.action.closeActiveEditor");
    }
  }
  else
  {
    vscode.commands.executeCommand("workbench.action.closeActiveEditor");
  }
};
示例#19
0
 Jupyter.prototype.registerKernelCommands = function () {
     var _this = this;
     this.disposables.push(vscode.commands.registerCommand(constants_1.Commands.Jupyter.Kernel.Kernel_Interrupt, function () {
         _this.kernel.interrupt();
     }));
     this.disposables.push(vscode.commands.registerCommand(constants_1.Commands.Jupyter.Kernel.Kernel_Restart, function () {
         _this.kernelManager.restartRunningKernelFor(_this.kernel.kernelSpec.language).then(function (kernel) {
             _this.onKernelChanged(kernel);
         });
     }));
     this.disposables.push(vscode.commands.registerCommand(constants_1.Commands.Jupyter.Kernel.Kernel_Interrupt, function () {
         _this.kernel.shutdown();
         _this.onKernelChanged();
     }));
 };
示例#20
0
 function registerCommand(command, callback) {
     return vscode.commands.registerCommand(command, (param) => __awaiter(this, void 0, void 0, function* () {
         yield new Promise((resolve, reject) => {
             sessionNamespace.run(() => __awaiter(this, void 0, void 0, function* () {
                 const session = startSession(command);
                 sessionNamespace.set(SESSION_KEY, session);
                 report(EventType.COMMAND_START, {
                     measures: { logLevel: LogLevel_1.LogLevel.INFO },
                     properties: Object.assign({}, session.getCustomEvent().properties),
                 });
                 try {
                     yield callback(param);
                     resolve();
                 }
                 catch (error) {
                     fatal(error, ExitCode_1.ExitCode.GENERAL_ERROR);
                     reject(error);
                 }
                 finally {
                     endSession(session);
                 }
             }));
         });
     }));
 }
示例#21
0
 return __awaiter(this, void 0, void 0, function* () {
     if (this.tagGenerators.length === 0) {
         return [];
     }
     const generatorsWithTagFiles = yield Promise.all(this.tagGenerators.map(generator => utils_1.fsExistsAsync(generator.tagFilePath)));
     if (generatorsWithTagFiles.filter(exists => exists).length !== this.tagGenerators.length) {
         yield vscode.commands.executeCommand(constants_1.Commands.Build_Workspace_Symbols, true, token);
     }
     const generators = yield Promise.all(this.tagGenerators.map((generator) => __awaiter(this, void 0, void 0, function* () {
         const tagFileExists = yield utils_1.fsExistsAsync(generator.tagFilePath);
         return tagFileExists ? generator : undefined;
     })));
     const promises = generators
         .filter(generator => generator !== undefined && generator.enabled)
         .map((generator) => __awaiter(this, void 0, void 0, function* () {
         // load tags
         const items = yield parser_1.parseTags(generator.workspaceFolder.fsPath, generator.tagFilePath, query, token);
         if (!Array.isArray(items)) {
             return [];
         }
         return items.map(item => new vscode.SymbolInformation(item.symbolName, item.symbolKind, '', new vscode.Location(vscode.Uri.file(item.fileName), item.position)));
     }));
     const symbols = yield Promise.all(promises);
     return _.flatten(symbols);
 });
示例#22
0
function activate(context) {
    console.log("Activated!")
    merlin = Merlin(vscode.workspace.getConfiguration('ocaml')['merlinPath']);
    merlin.restartMerlinProcess();
    
    vscode.languages.registerHoverProvider(['*', 'ocaml'],
        {provideHover: (document, position, token) => {
            //return new vscode.Hover([{language: 'ocaml', value: 'let x = 2'}]);
            console.log("before")
            try{
            return merlin.getTypeAt(
                document.fileName, 
                position,
                vscode.workspace.textDocuments).then(v => {
                    console.log("STUFFF>>", res, typeof res);        
                    return new vscode.Hover([{language: 'ocaml', value: 'let x = 2'}]);
                });
            } catch (e) {console.log(e)}
        }}
    );
    
    
    vscode.workspace.onDidSaveTextDocument((doc) => {
        var b = (doc.languageId === 'ocaml' && vscode.workspace.getConfiguration('ocaml')['indentOnSave']);
        if (b) reformat();
    });
    
    var disposable = vscode.commands.registerCommand('extension.format', function () {
        reformat();
    });
}
示例#23
0
 vscode.window["onDidChangeTextEditorVisibleRanges"]((event) => {
     const textEditor = event.textEditor;
     if (Date.now() < editorScrollDelay) {
         return;
     }
     if (preview_content_provider_1.isMarkdownFile(textEditor.document)) {
         const previewUri = preview_content_provider_1.getPreviewUri(textEditor.document.uri);
         if (previewUri) {
             if (!event.textEditor["visibleRanges"].length) {
                 return undefined;
             }
             else {
                 const topLine = getTopVisibleLine(textEditor);
                 const bottomLine = getBottomVisibleLine(textEditor);
                 let midLine;
                 if (topLine === 0) {
                     midLine = 0;
                 }
                 else if (Math.floor(bottomLine) ===
                     textEditor.document.lineCount - 1) {
                     midLine = bottomLine;
                 }
                 else {
                     midLine = Math.floor((topLine + bottomLine) / 2);
                 }
                 vscode.commands.executeCommand("_workbench.htmlPreview.postMessage", previewUri, {
                     command: "changeTextEditorSelection",
                     line: midLine,
                 });
             }
         }
     }
 }));
示例#24
0
 return __awaiter(this, void 0, void 0, function* () {
     if (!(uri instanceof vscode_1.Uri)) {
         if (!editor || !editor.document)
             return undefined;
         uri = editor.document.uri;
     }
     const gitUri = yield gitProvider_1.GitUri.fromUri(uri, this.git);
     line = line || (editor && editor.selection.active.line) || gitUri.offset;
     if (!commit || gitProvider_1.GitProvider.isUncommitted(commit.sha)) {
         if (editor && editor.document && editor.document.isDirty)
             return undefined;
         const blameline = line - gitUri.offset;
         if (blameline < 0)
             return undefined;
         try {
             const blame = yield this.git.getBlameForLine(gitUri.fsPath, blameline, gitUri.sha, gitUri.repoPath);
             if (!blame)
                 return vscode_1.window.showWarningMessage(`Unable to open diff. File is probably not under source control`);
             commit = blame.commit;
             if (commit.isUncommitted) {
                 commit = new gitProvider_1.GitCommit(commit.repoPath, commit.previousSha, commit.previousFileName, commit.author, commit.date, commit.message);
                 line = blame.line.line + 1 + gitUri.offset;
             }
         }
         catch (ex) {
             logger_1.Logger.error('[GitLens.DiffLineWithWorkingCommand]', `getBlameForLine(${blameline})`, ex);
             return vscode_1.window.showErrorMessage(`Unable to open diff. See output channel for more details`);
         }
     }
     return vscode_1.commands.executeCommand(commands_1.Commands.DiffWithWorking, uri, commit, line);
 });
示例#25
0
 function showRuleDocumentation(_uri, _documentVersion, _edits, ruleId) {
     const tslintDocBaseURL = "https://palantir.github.io/tslint/rules";
     if (!ruleId) {
         return;
     }
     vscode_1.commands.executeCommand('vscode.open', vscode_1.Uri.parse(tslintDocBaseURL + '/' + ruleId));
 }
示例#26
0
function activateUnitTestProvider(context, settings, outputChannel) {
    pythonOutputChannel = outputChannel;
    vscode.commands.registerCommand("python.runtests", function () { return runUnitTests(); });
    testProviders.push(new unittest.PythonUnitTest(settings, outputChannel, vscode.workspace.rootPath));
    testProviders.push(new nosetest.NoseTests(settings, outputChannel, vscode.workspace.rootPath));
    testProviders.push(new pytest.PyTestTests(settings, outputChannel, vscode.workspace.rootPath));
}
示例#27
0
function activate(context) {
    var previewUri = vscode.Uri.parse('mixliveserver://autority/' + config["rootPath"] + '/index.html');
    var params = {
        port: config["port"],
        root: projectPath,
        open: false,
    };
    // start the server
    liveserver.start(params);
    var MixLiveServerContentProvider = (function () {
        function MixLiveServerContentProvider() {
            this._onDidChange = new vscode.EventEmitter();
        }
        MixLiveServerContentProvider.prototype.provideTextDocumentContent = function (uri) {
            return "<!DOCTYPE html><html><head><style>\n\t\thtml, body, canvas, div {\n\t\t\tmargin:0;\n\t\t\tpadding: 0;\t\t\t\n\t\t\twidth:100%;\n\t\t\theight:100%;\n\t\t}\n\t\t#khanvas {\n\t\t\tdisplay:block;\n\t\t\tborder:none;\n\t\t\toutline:none;\n\t\t}\n\t</style></head><body><iframe src=\"http://127.0.0.1:8181\" width=\"100%\" height=\"100%\" frameBorder=\"0\"></iframe><div class=\"svgbg\"></div></body></html>";
        };
        return MixLiveServerContentProvider;
    }());
    var provider = new MixLiveServerContentProvider();
    var registration = vscode.workspace.registerTextDocumentContentProvider('mixliveserver', provider);
    var open = vscode.commands.registerTextEditorCommand('mixliveserver.open', function (te, t) {
        return vscode.commands.executeCommand('vscode.previewHtml', previewUri, vscode.ViewColumn.Two)
            .then(function (s) { return console.log('done.'); }, vscode.window.showErrorMessage);
    });
    context.subscriptions.push(open);
}
示例#28
0
module.exports = function(getSyncHelper) {

	if(!vscode.window.activeTextEditor || 
	   !vscode.window.activeTextEditor.document ||
	   !vscode.window.activeTextEditor.document.syncOptions) {
		vscode.window.showErrorMessage("Ftp-sync: no operations list to commit. Run sync first.");
		return;
	}
	
	var options = vscode.window.activeTextEditor.document.syncOptions;
	var syncJson = vscode.window.activeTextEditor.document.getText();
    
    var jsonCorrect = true;
    try
    {
	   var sync = JSON.parse(syncJson);
    }
    catch(err) 
    {
        vscode.window.showErrorMessage("Ftp-sync: review file is not a correct JSON (" + err.message + ")");
        jsonCorrect = false;
    }

    if(jsonCorrect) {
        vscode.commands.executeCommand("workbench.files.action.closeFile");
        helper.executeSync(getSyncHelper(), sync, options);
    }
}
示例#29
0
 constructor(server, optionProvider) {
     super(server);
     this.optionProvider = optionProvider;
     this._commandId = 'omnisharp.runCodeAction';
     let registerCommandDisposable = vscode.commands.registerCommand(this._commandId, this._runCodeAction, this);
     this.addDisposables(new CompositeDisposable_1.default(registerCommandDisposable));
 }
示例#30
0
 promise.then(function(action) {
   if (!action) {
     return;
   }
   
   vscode.commands.executeCommand('workbench.extensions.action.listOutdatedExtensions');
 });