当前位置: 首页>>代码示例>>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;未经允许,请勿转载。