當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript LanguageClient.sendNotification方法代碼示例

本文整理匯總了TypeScript中vscode-languageclient.LanguageClient.sendNotification方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript LanguageClient.sendNotification方法的具體用法?TypeScript LanguageClient.sendNotification怎麽用?TypeScript LanguageClient.sendNotification使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在vscode-languageclient.LanguageClient的用法示例。


在下文中一共展示了LanguageClient.sendNotification方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: LanguageClient

	languages.getLanguages().then(languageIds => {

		// The server is implemented in node
		let serverModule = context.asAbsolutePath(path.join('server', 'out', 'jsonServerMain.js'));
		// The debug options for the server
		let debugOptions = { execArgv: ['--nolazy', '--debug=6004'] };

		// If the extension is launch in debug mode the debug server options are use
		// Otherwise the run options are used
		let serverOptions: ServerOptions = {
			run: { module: serverModule, transport: TransportKind.ipc },
			debug: { module: serverModule, transport: TransportKind.ipc, options: debugOptions }
		};

		// Options to control the language client
		let clientOptions: LanguageClientOptions = {
			// Register the server for json documents
			documentSelector: ['json'],
			synchronize: {
				// Synchronize the setting section 'json' to the server
				configurationSection: ['json.schemas', 'http.proxy', 'http.proxyStrictSSL'],
				fileEvents: workspace.createFileSystemWatcher('**/*.json')
			},
			initializationOptions: {
				languageIds,
				['format.enable']: workspace.getConfiguration('json').get('format.enable')
			}
		};

		// Create the language client and start the client.
		let client = new LanguageClient('json', localize('jsonserver.name', 'JSON Language Server'), serverOptions, clientOptions);
		client.onTelemetry(e => {
			if (telemetryReporter) {
				telemetryReporter.sendTelemetryEvent(e.key, e.data);
			}
		});

		// handle content request
		client.onRequest(VSCodeContentRequest.type, (uriPath: string) => {
			let uri = Uri.parse(uriPath);
			return workspace.openTextDocument(uri).then(doc => {
				return doc.getText();
			}, error => {
				return Promise.reject(error);
			});
		});

		let disposable = client.start();

		client.sendNotification(SchemaAssociationNotification.type, getSchemaAssociation(context));

		// Push the disposable to the context's subscriptions so that the
		// client can be deactivated on extension deactivation
		context.subscriptions.push(disposable);

		languages.setLanguageConfiguration('json', {
			wordPattern: /("(?:[^\\\"]*(?:\\.)?)*"?)|[^\s{}\[\],:]+/
		});
	});
開發者ID:elemongw,項目名稱:vscode,代碼行數:59,代碼來源:jsonMain.ts

示例2: update

export function update(preview_uri: Uri)
{
  const document_uri = decode_preview(preview_uri)
  if (document_uri && language_client) {
    language_client.sendNotification(protocol.preview_request_type,
      { uri: document_uri.toString(), column: 0 })
  }
}
開發者ID:seL4,項目名稱:isabelle,代碼行數:8,代碼來源:preview.ts

示例3:

 vscode.workspace.onDidSaveTextDocument((doc) => {
     if (this.languageClient && this.isDocumentRemote(doc)) {
         this.languageClient.sendNotification(
             DidSaveTextDocumentNotificationType,
             {
                 textDocument: TextDocumentIdentifier.create(doc.uri.toString()),
             });
     }
 });
開發者ID:dfinke,項目名稱:vscode-powershell,代碼行數:9,代碼來源:RemoteFiles.ts

示例4: request

export function request(uri?: Uri, split: boolean = false)
{
  const document_uri = uri || window.activeTextEditor.document.uri
  const preview_uri = encode_preview(document_uri)
  if (preview_uri && language_client) {
    language_client.sendNotification(protocol.preview_request_type,
      { uri: document_uri.toString(),
        column: library.adjacent_editor_column(window.activeTextEditor, split) })
  }
}
開發者ID:seL4,項目名稱:isabelle,代碼行數:10,代碼來源:preview.ts

示例5: notifyFileChange

 function notifyFileChange(type: number, uri: vscode.Uri) {
     let args /*: DidChangeWatchedFilesParams */ = {
         changes: [
             {
                 uri: uri.toString(),
                 type: type
             }
         ]
     };
     client.sendNotification("workspace/didChangeWatchedFiles", args);
 }
開發者ID:peq,項目名稱:wurst4vscode,代碼行數:11,代碼來源:extension.ts

示例6: activate

export function activate(context: ExtensionContext) {

	// The server is implemented in node
	let serverModule = context.asAbsolutePath(path.join('server', 'out', 'server.js'));
	// The debug options for the server
	let debugOptions = { execArgv: ['--nolazy', '--debug=6004'] };

	// If the extension is launch in debug mode the debug server options are use
	// Otherwise the run options are used
	let serverOptions: ServerOptions = {
		run: { module: serverModule, transport: TransportKind.ipc },
		debug: { module: serverModule, transport: TransportKind.ipc, options: debugOptions }
	};

	// Options to control the language client
	let clientOptions: LanguageClientOptions = {
		// Register the server for json documents
		documentSelector: ['json'],
		synchronize: {
			// Synchronize the setting section 'json' to the server
			configurationSection: ['json.schemas', 'http.proxy', 'http.proxyStrictSSL'],
			fileEvents: workspace.createFileSystemWatcher('**/.json')
		}
	};

	// Create the language client and start the client.
	let client = new LanguageClient('JSON Server', serverOptions, clientOptions);
	client.onNotification(TelemetryNotification.type, (e) => {
		// to be done
	});

	// handle content request
	client.onRequest(VSCodeContentRequest.type, (uriPath: string) => {
		let uri = Uri.parse(uriPath);
		return workspace.openTextDocument(uri).then(doc => {
			return doc.getText();
		}, error => {
			return Promise.reject(error);
		});
	});

	let disposable = client.start();

	client.sendNotification(SchemaAssociationNotification.type, getSchemaAssociation(context));

	// Push the disposable to the context's subscriptions so that the
	// client can be deactivated on extension deactivation
	context.subscriptions.push(disposable);

	languages.setLanguageConfiguration('json', {
		wordPattern: /(-?\d*\.\d\w*)|([^\[\{\]\}\:\"\,\s]+)/g
	});
}
開發者ID:ErickWendel,項目名稱:vscode,代碼行數:53,代碼來源:jsonMain.ts

示例7: getSchemaAssociation

		client.onReady().then(() => {
			client.onTelemetry(e => {
				if (telemetryReporter) {
					telemetryReporter.sendTelemetryEvent(e.key, e.data);
				}
			});

			// handle content request
			client.onRequest(VSCodeContentRequest.type, (uriPath: string) => {
				let uri = Uri.parse(uriPath);
				return workspace.openTextDocument(uri).then(doc => {
					return doc.getText();
				}, error => {
					return Promise.reject(error);
				});
			});

			client.sendNotification(SchemaAssociationNotification.type, getSchemaAssociation(context));
		});
開發者ID:pk-codebox-evo,項目名稱:ide-microsoft-vscode,代碼行數:19,代碼來源:jsonMain.ts

示例8: LanguageClient

	languages.getLanguages().then(languageIds => {

		// The server is implemented in node
		let serverModule = context.asAbsolutePath(path.join('server', 'out', 'jsonServerMain.js'));
		// The debug options for the server
		let debugOptions = { execArgv: ['--nolazy', '--debug=6004'] };

		// If the extension is launch in debug mode the debug server options are use
		// Otherwise the run options are used
		let serverOptions: ServerOptions = {
			run: { module: serverModule, transport: TransportKind.ipc },
			debug: { module: serverModule, transport: TransportKind.ipc, options: debugOptions }
		};

		// Options to control the language client
		let clientOptions: LanguageClientOptions = {
			// Register the server for json documents
			documentSelector: ['json'],
			synchronize: {
				// Synchronize the setting section 'json' to the server
				configurationSection: ['json.schemas', 'http.proxy', 'http.proxyStrictSSL'],
				fileEvents: workspace.createFileSystemWatcher('**/*.json')
			},
			initializationOptions: {
				languageIds
			}
		};

		// Create the language client and start the client.
		let client = new LanguageClient('JSON Server', serverOptions, clientOptions);
		client.onTelemetry(e => {
			if (telemetryReporter) {
				telemetryReporter.sendTelemetryEvent(e.key, e.data);
			}
		});

		// handle content request
		client.onRequest(VSCodeContentRequest.type, (uriPath: string) => {
			let uri = Uri.parse(uriPath);
			return workspace.openTextDocument(uri).then(doc => {
				return doc.getText();
			}, error => {
				return Promise.reject(error);
			});
		});

		let disposable = client.start();

		client.sendNotification(SchemaAssociationNotification.type, getSchemaAssociation(context));

		// Push the disposable to the context's subscriptions so that the
		// client can be deactivated on extension deactivation
		context.subscriptions.push(disposable);

		languages.setLanguageConfiguration('json', {
			wordPattern: /(-?\d*\.\d\w*)|([^\[\{\]\}\:\"\,\s]+)/g,
			__characterPairSupport: {
				autoClosingPairs: [
					{ open: '{', close: '}' },
					{ open: '[', close: ']' },
					{ open: '(', close: ')' },
					{ open: '"', close: '"', notIn: ['string'] },
					{ open: '\'', close: '\'', notIn: ['string', 'comment'] },
					{ open: '`', close: '`', notIn: ['string', 'comment'] }
				]
			}
		});
	});
開發者ID:ArtsyLee,項目名稱:vscode,代碼行數:68,代碼來源:jsonMain.ts

示例9:

		configurationListener = vscode.workspace.onDidChangeConfiguration(() => {
			languageClient.sendNotification(DidChangeConfigurationNotification.type, { settings: null });
		});
開發者ID:emuhedo,項目名稱:pyre-check,代碼行數:3,代碼來源:main.ts

示例10:

 workspace.findFiles("**/*.tq").then((urls) => {
   client.sendNotification("torque/fileList",
     { files: urls.map((url) => url.toString())});
 });
開發者ID:dnalborczyk,項目名稱:node,代碼行數:4,代碼來源:extension.ts


注:本文中的vscode-languageclient.LanguageClient.sendNotification方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。