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


TypeScript LanguageClient.start方法代碼示例

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


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

示例1: activate

export function activate(context: ExtensionContext) {
    setLogLevel();
    workspace.onDidChangeConfiguration(setLogLevel); 

    // The server is implemented in node
    let serverModule = context.asAbsolutePath(path.join('server', 'src', '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 plain text documents
        documentSelector: ['haskell'],
        synchronize: {
            // Synchronize the setting section 'ghcMod' to the server
            configurationSection: 'haskell.ghcMod'
        }
    };

    // Create the language client and start the client.
    let languageClient = new LanguageClient('ghc-mod server', serverOptions, clientOptions);
    let disposable = languageClient.start();

    // Push the disposable to the context's subscriptions so that the
    // client can be deactivated on extension deactivation
    context.subscriptions.push(disposable);
    Commands.register(context, languageClient);
}
開發者ID:theor,項目名稱:vscode-ghc-mod,代碼行數:35,代碼來源:extension.ts

示例2: activate

export function activate(context: vscode.ExtensionContext) {
    // TODO: make this configurable
    const clangdPath = '/usr/bin/clangd';

    const serverOptions: vscodelc.ServerOptions = { command: clangdPath };

    const clientOptions: vscodelc.LanguageClientOptions = {
        // Register the server for C/C++ files
        documentSelector: ['c', 'cc', 'cpp', 'h', 'hh', 'hpp']
    };

    const clangdClient = new vscodelc.LanguageClient('Clang Language Server', serverOptions, clientOptions);

    function applyTextEdits(uri: string, edits: vscodelc.TextEdit[]) {
        let textEditor = vscode.window.activeTextEditor;

        if (textEditor && textEditor.document.uri.toString() === uri) {
            textEditor.edit(mutator => {
                for (const edit of edits) {
                    mutator.replace(vscodelc.Protocol2Code.asRange(edit.range), edit.newText);
                }
            }).then((success) => {
                if (!success) {
                    vscode.window.showErrorMessage('Failed to apply fixes to the document.');
                }
            });
        }
    }

    console.log('Clang Language Server is now active!');

    const disposable = clangdClient.start();

    context.subscriptions.push(disposable, vscode.commands.registerCommand('clangd.applyFix', applyTextEdits));
}
開發者ID:grizonnetm,項目名稱:clang-tools-extra,代碼行數:35,代碼來源:extension.ts

示例3: startLanguageClient

async function startLanguageClient(context: ExtensionContext) {
    let cfg = vscode.workspace.getConfiguration("wurst")

    let clientOptions: LanguageClientOptions = {
		// Register the server for Wurst-documents
		documentSelector: ['wurst'],
		synchronize: {
			// Synchronize the setting section 'wurst' to the server
			configurationSection: 'wurst',
            // Notify the server about file changes to '.wurst files contain in the workspace
            // currently disabled, because not working
            // using manual workaround in registerFileChanges instead
			// fileEvents: workspace.createFileSystemWatcher('**/*.wurst')
		}
    }

    let serverOptions = await getServerOptions();

    let client = new LanguageClient("wurstLanguageServer", serverOptions, clientOptions);
    context.subscriptions.push(client.start());

    context.subscriptions.push(registerCommands(client));
    context.subscriptions.push(registerFileCreation());
    context.subscriptions.push(registerFileChanges(client));
}
開發者ID:peq,項目名稱:wurst4vscode,代碼行數:25,代碼來源:extension.ts

示例4: activate

export function activate(context: vscode.ExtensionContext) {
	let config = RedConfiguration.getInstance();

	context.subscriptions.push(vscode.commands.registerCommand("red.interpret", () => redRunInConsole()));
	context.subscriptions.push(vscode.commands.registerCommand("red.interpretGUI", () => redRunInGuiConsole()));
	context.subscriptions.push(vscode.commands.registerCommand("red.compile", () => redCompileInConsole()));
	context.subscriptions.push(vscode.commands.registerCommand("red.compileGUI", () => redCompileInGuiConsole()));
	context.subscriptions.push(vscode.commands.registerCommand("reds.compile", () => redCompileInConsole()));
	context.subscriptions.push(vscode.commands.registerCommand("reds.compileGUI", () => redCompileInGuiConsole()));
	context.subscriptions.push(vscode.commands.registerCommand("red.commandMenu", setCommandMenu));

	console.log("Red console path: ", config.redConsole)
	let serverModule = path.join(context.asAbsolutePath("."), "server", "server.red");
	let needlog = "debug-off";
	if (config.needRlsDebug) {
		needlog = "debug-on";
	}
	console.log(needlog);
	const serverOptions: vscodelc.ServerOptions = {
		run : { command: config.redConsole, args: [serverModule, needlog]},
		debug: { command: config.redConsole, args: [serverModule, "debug-on"] }
	};
	const clientOptions: vscodelc.LanguageClientOptions = {
		documentSelector: [{scheme: 'file', language: 'red'}],
		initializationOptions: config.allConfigs || {},
		synchronize: {
			configurationSection: 'red'
		}
	}
	reddClient = new vscodelc.LanguageClient('red.server', 'Red Language Server', serverOptions, clientOptions);
	console.log('Red Language Server is now active!');
	context.subscriptions.push(reddClient.start());
}
開發者ID:red,項目名稱:VScode-extension,代碼行數:33,代碼來源:extension.ts

示例5: activate

export function activate(context: ExtensionContext) {
    // Load the path to the language server from settings
    let executableCommand = workspace.getConfiguration("swift")
        .get("languageServerPath", "/usr/local/bin/LanguageServer");

    let run: Executable = { command: executableCommand };
    let debug: Executable = run;
    let serverOptions: ServerOptions = {
        run: run,
        debug: debug
    };
    
    // client extensions configure their server
    let clientOptions: LanguageClientOptions = {
        documentSelector: [
            { language: 'swift', scheme: 'file' },
            { language: 'swift', scheme: 'untitled' }
        ],
        synchronize: {
            configurationSection: 'swift',
            fileEvents: [
                workspace.createFileSystemWatcher('**/*.swift', false, true, false),
                workspace.createFileSystemWatcher('**/.build/{debug,release}.yaml', false, false, false)
            ]
        }
    }

    let client = new LanguageClient('Swift', serverOptions, clientOptions);

    // Push the disposable to the context's subscriptions so that the
    // client can be deactivated on extension deactivation
    context.subscriptions.push(client.start());
}
開發者ID:RLovelett,項目名稱:vscode-swift,代碼行數:33,代碼來源:extension.ts

示例6: start

 private start(): void {
     this.logger.debug('start');
     this.languageClient.start();
     // As we started the language client, we need to enable the indicator in order to allow the user restart the language client.
     this.statusBarItem.setText('Starting');
     this.statusBarItem.enable();
 }
開發者ID:KalitaAlexey,項目名稱:RustyCode,代碼行數:7,代碼來源:manager.ts

示例7: activate

export function activate(context: ExtensionContext) {

	let config = workspace.getConfiguration("gluon");
	let serverPath = config.get("language-server.path", "gluon_language-server");
	
	// If the extension is launched in debug mode then the debug server options are used
	// Otherwise the run options are used
	let serverOptions: ServerOptions = {
		command : serverPath,
		args: [],
		options: {}
	}

	// Options to control the language client
	let clientOptions: LanguageClientOptions = {
		// Register the server for plain text documents
		documentSelector: ['gluon'],
		synchronize: {
			// Synchronize the setting section 'languageServerExample' to the server
			configurationSection: 'gluon',
			// Notify the server about file changes to '.clientrc files contain in the workspace
			fileEvents: workspace.createFileSystemWatcher('**/.clientrc')
		}
	}
	
	// Create the language client and start the client.
	let client = new LanguageClient('gluon', serverOptions, clientOptions);
	let disposable = client.start();
	
	// Push the disposable to the context's subscriptions so that the 
	// client can be deactivated on extension deactivation
	context.subscriptions.push(disposable);
}
開發者ID:Marwes,項目名稱:gluon_language-server,代碼行數:33,代碼來源:extension.ts

示例8: activateLanguageServer

export async function activateLanguageServer(context: vscode.ExtensionContext) {
    const r = RLanguage.language;
    // The server is implemented in C#
    const commandOptions = { stdio: "pipe" };
    const serverModule = context.extensionPath + "/server/Microsoft.R.LanguageServer.dll";

    // If the extension is launched in debug mode then the debug server options are used
    // Otherwise the run options are used
    const serverOptions: languageClient.ServerOptions = {
        debug: { command: "dotnet", args: [serverModule, "--debug"], options: commandOptions },
        run: { command: "dotnet", args: [serverModule], options: commandOptions },
    };

    // Options to control the language client
    const clientOptions: languageClient.LanguageClientOptions = {
        // Register the server for R documents
        documentSelector: [r],
        synchronize: {
            configurationSection: r,
        },
    };

    // Create the language client and start the client.
    client = new languageClient.LanguageClient(r, "R Tools", serverOptions, clientOptions);
    context.subscriptions.push(client.start());

    await client.onReady();

    rEngine = new REngine(client);
    const resultsView = new ResultsView();
    context.subscriptions.push(vscode.workspace.registerTextDocumentContentProvider("r", resultsView));

    commands = new Commands(rEngine, resultsView);
    context.subscriptions.push(...commands.activateCommandsProvider());
}
開發者ID:karthiknadig,項目名稱:RTVS,代碼行數:35,代碼來源:extension.ts

示例9: handleServer

function* handleServer() {
  yield take(EXPRESS_SERVER_STARTED);
  const { context, childDevServerInfo: { port } }: ExtensionState = yield select();

  const serverOptions: ServerOptions = {
    run: { module: SERVER_MODULE_PATH, transport: TransportKind.ipc },
    debug: { module: SERVER_MODULE_PATH, transport: TransportKind.ipc, options: { execArgv: ["--nolazy", "--inspect=6005"]}}
  };

  const documentSelector = ["paperclip"];
  const config = workspace.getConfiguration();
  
  const clientOptions: LanguageClientOptions = {
    documentSelector,
    synchronize: {
      configurationSection: ["html", "paperclip", "tandem"]
    },
    initializationOptions: {
      devToolsPort: port
    }
  }

  const client = new LanguageClient("paperclip", "Paperclip Language Server", serverOptions, clientOptions);

  context.subscriptions.push(client.start());

}
開發者ID:cryptobuks,項目名稱:tandem,代碼行數:27,代碼來源:language-client.ts

示例10: run

function run(serverOptions: ServerOptions, isOldServer: boolean) {
  const clientOptions: LanguageClientOptions = {
    documentSelector: [
      { scheme: 'file', pattern: '**/*.sc' },
      { scheme: 'untitled', pattern: '**/*.sc' },
      { scheme: 'file', pattern: '**/*.scala' },
      { scheme: 'untitled', pattern: '**/*.scala' }
    ],
    synchronize: {
      configurationSection: 'dotty'
    },
    outputChannel: outputChannel,
    revealOutputChannelOn: RevealOutputChannelOn.Never
  }

  client = new LanguageClient("dotty", "Dotty", serverOptions, clientOptions)
  if (isOldServer)
    enableOldServerWorkaround(client)

  client.onReady().then(() => {
    client.onNotification("worksheet/publishOutput", (params) => {
      worksheet.handleMessage(params)
    })
  })

  vscode.commands.registerCommand(worksheet.worksheetEvaluateKey, () => {
    worksheet.evaluateWorksheetCommand()
  })

  // Push the disposable to the context's subscriptions so that the
  // client can be deactivated on extension deactivation
  extensionContext.subscriptions.push(client.start());
}
開發者ID:olhotak,項目名稱:dotty,代碼行數:33,代碼來源:extension.ts


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