当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript vscode.workspace.textDocuments类代码示例

本文整理汇总了TypeScript中vscode.workspace.textDocuments的典型用法代码示例。如果您正苦于以下问题:TypeScript workspace.textDocuments类的具体用法?TypeScript workspace.textDocuments怎么用?TypeScript workspace.textDocuments使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了workspace.textDocuments类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1:

		return Promise.all([workspace.openTextDocument(uri), workspace.openTextDocument(uri)]).then(docs => {
			let [first, second] = docs;
			assert.ok(first === second);
			assert.ok(workspace.textDocuments.some(doc => doc.uri.toString() === uri.toString()));
			assert.equal(callCount, 1);
			registration.dispose();
		});
开发者ID:sangohan,项目名称:KodeStudio,代码行数:7,代码来源:workspace.test.ts

示例2: if

 workspace.onDidChangeConfiguration(() => {
     workspace.textDocuments.forEach(document => {
         if (document.uri.scheme === ConstVariable.markdownScheme) {
             dfmPreviewProcessor.updateContent(document.uri);
         } else if (document.uri.scheme === ConstVariable.tokenTreeScheme) {
             tokenTreeProcessor.updateContent(document.uri);
         }
     });
 });
开发者ID:928PJY,项目名称:docfx,代码行数:9,代码来源:extension.ts

示例3: updatePriorityFiles

	updatePriorityFiles() {
		let visibleDocuments = window.visibleTextEditors.map(e => e.document);
		let otherOpenDocuments = workspace.textDocuments.filter(doc => visibleDocuments.indexOf(doc) == -1);

		let priorityDocuments = visibleDocuments.concat(otherOpenDocuments).filter(d => util.isAnalyzable(d));
		let priorityFiles = priorityDocuments.map(doc => doc.fileName);

		this.analyzer.analysisSetPriorityFiles({
			files: priorityFiles
		}).then(() => {}, e => console.warn(e.message));
	}
开发者ID:ikhwanhayat,项目名称:Dart-Code,代码行数:11,代码来源:open_file_tracker.ts

示例4: restart

 /** Stops the running language client if any and starts a new one. */
 private async restart(): Promise<void> {
     const isAnyDocumentDirty = !workspace.textDocuments.every(t => !t.isDirty);
     if (isAnyDocumentDirty) {
         window.showErrorMessage('You have unsaved changes. Save or discard them and try to restart again');
         return;
     }
     await this.stop();
     this.languageClient = this.languageClientCreator.create();
     this.subscribeOnStateChanging();
     this.start();
 }
开发者ID:KalitaAlexey,项目名称:RustyCode,代码行数:12,代码来源:manager.ts

示例5: test

	test('Convert from yaml to tmLanguage', async function() {
		const textDocument = await workspace.openTextDocument(jsonTestFile);
		const textEditor = await window.showTextDocument(textDocument);

		const fileConverter: FileConverter = new FileConverter();
		var success : boolean = await fileConverter.convertFileToTml();
		assert.equal(true, success);

		let resultDoc = workspace.textDocuments.find((doc : TextDocument) => { return doc.fileName == jsonResultFile;});
		var text = resultDoc.getText();
		assert.notEqual(text, "");
	});
开发者ID:Togusa09,项目名称:vscode-tmlanguage,代码行数:12,代码来源:extension.test.ts

示例6: encode_preview

  language_client.onNotification(protocol.preview_response_type, params =>
    {
      const preview_uri = encode_preview(Uri.parse(params.uri))
      if (preview_uri) {
        content_provider.set_content(preview_uri, params.content)
        content_provider.update(preview_uri)

        const existing_document =
          workspace.textDocuments.find(document =>
            document.uri.scheme === preview_uri.scheme &&
            document.uri.query === preview_uri.query)
        if (!existing_document && params.column != 0) {
          commands.executeCommand("vscode.previewHtml", preview_uri, params.column, params.label)
        }
      }
    })
开发者ID:seL4,项目名称:isabelle,代码行数:16,代码来源:preview.ts

示例7: selectDocument

    function selectDocument() {
        if (isViableEditor(window.activeTextEditor)) {
            return window.activeTextEditor!.document;
        }

        const docs = workspace.textDocuments
            .filter(isSupportedDoc);

        if (lastUri) {
            const candidate = docs
                .filter(document => document.uri.toString() === lastUri)
                .shift();
            if (candidate) return candidate;
        }

        return docs.shift();
    }
开发者ID:Jason-Rev,项目名称:vscode-spell-checker,代码行数:17,代码来源:statusbar.ts

示例8: encode_state

  language_client.onNotification(protocol.state_output_type, params =>
    {
      const uri = encode_state(params.id)
      if (uri) {
        content_provider.set_content(uri, params.content)
        content_provider.update(uri)

        const existing_document =
          workspace.textDocuments.find(document =>
            document.uri.scheme === uri.scheme &&
            document.uri.fragment === uri.fragment)
        if (!existing_document) {
          const column = library.adjacent_editor_column(window.activeTextEditor, true)
          commands.executeCommand("vscode.previewHtml", uri, column, "State")
        }
      }
    })
开发者ID:seL4,项目名称:isabelle,代码行数:17,代码来源:state_panel.ts

示例9: checkVariablesInAllTextDocuments

 public checkVariablesInAllTextDocuments() {
     workspace.textDocuments.forEach(this.checkVariables, this);
 }
开发者ID:Huachao,项目名称:vscode-restclient,代码行数:3,代码来源:variableDiagnosticsProvider.ts

示例10: activate

export function activate(context: ExtensionContext) {

	let module = context.asAbsolutePath(path.join('server', 'out', 'server.js'));
	let outputChannel: OutputChannel = Window.createOutputChannel('lsp-multi-server-example');

	function didOpenTextDocument(document: TextDocument): void {
		// We are only interested in language mode text
		if (document.languageId !== 'plaintext' || (document.uri.scheme !== 'file' && document.uri.scheme !== 'untitled')) {
			return;
		}

		let uri = document.uri;
		// Untitled files go to a default client.
		if (uri.scheme === 'untitled' && !defaultClient) {
			let debugOptions = { execArgv: ["--nolazy", "--inspect=6010"] };
			let serverOptions = {
				run: { module, transport: TransportKind.ipc },
				debug: { module, transport: TransportKind.ipc, options: debugOptions}
			};
			let clientOptions: LanguageClientOptions = {
				documentSelector: [
					{ scheme: 'untitled', language: 'plaintext' }
				],
				diagnosticCollectionName: 'lsp-multi-server-example',
				outputChannel: outputChannel
			}
			defaultClient = new LanguageClient('lsp-multi-server-example', 'LSP Multi Server Example', serverOptions, clientOptions);
			defaultClient.start();
			return;
		}
		let folder = Workspace.getWorkspaceFolder(uri);
		// Files outside a folder can't be handled. This might depend on the language.
		// Single file languages like JSON might handle files outside the workspace folders.
		if (!folder) {
			return;
		}
		// If we have nested workspace folders we only start a server on the outer most workspace folder.
		folder = getOuterMostWorkspaceFolder(folder);

		if (!clients.has(folder.uri.toString())) {
			let debugOptions = { execArgv: ["--nolazy", `--inspect=${6011 + clients.size}`] };
			let serverOptions = {
				run: { module, transport: TransportKind.ipc },
				debug: { module, transport: TransportKind.ipc, options: debugOptions}
			};
			let clientOptions: LanguageClientOptions = {
				documentSelector: [
					{ scheme: 'file', language: 'plaintext', pattern: `${folder.uri.fsPath}/**/*` }
				],
				diagnosticCollectionName: 'lsp-multi-server-example',
				workspaceFolder: folder,
				outputChannel: outputChannel
			}
			let client = new LanguageClient('lsp-multi-server-example', 'LSP Multi Server Example', serverOptions, clientOptions);
			client.start();
			clients.set(folder.uri.toString(), client);
		}
	}

	Workspace.onDidOpenTextDocument(didOpenTextDocument);
	Workspace.textDocuments.forEach(didOpenTextDocument);
	Workspace.onDidChangeWorkspaceFolders((event) => {
		for (let folder  of event.removed) {
			let client = clients.get(folder.uri.toString());
			if (client) {
				clients.delete(folder.uri.toString());
				client.stop();
			}
		}
	});
}
开发者ID:voodoos,项目名称:vscode-extension-samples,代码行数:71,代码来源:extension.ts


注:本文中的vscode.workspace.textDocuments类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。