Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio code 如何连接由C++;_Visual Studio Code_Vscode Extensions_Language Server Protocol - Fatal编程技术网

Visual studio code 如何连接由C++;

Visual studio code 如何连接由C++;,visual-studio-code,vscode-extensions,language-server-protocol,Visual Studio Code,Vscode Extensions,Language Server Protocol,我假设协议使用stdin/stdout作为通道 但是当我启动vscode调试时,我的exe不会启动。 如何启动exe 我的配置: { "type": "extensionHost", "request": "launch", "name": "Launch Client", // "runtimeExe

我假设协议使用stdin/stdout作为通道

但是当我启动vscode调试时,我的exe不会启动。 如何启动exe


我的配置:

{
        "type": "extensionHost",
        "request": "launch",
        "name": "Launch Client",
        // "runtimeExecutable": "${execPath}",
        "runtimeExecutable": "C:/vscode-ext/lsp_cpp_ravi/cmake-build-debug/lsp-aaa.exe",
        "args": ["--extensionDevelopmentPath=${workspaceRoot}"],
        "outFiles": ["${workspaceRoot}/client/out/**/*.js"],
        "preLaunchTask": {
            "type": "npm",
            "script": "watch"
        }
    },
此配置是从lsp示例复制的,我更改了runtimeexecutable字段


客户端代码:

export function activate(context: ExtensionContext) {
    // The server is implemented in node
    // let serverModule = context.asAbsolutePath(
    //  // path.join('server', 'out', 'server.js')
    //  path.join('C:\\vscode-ext\\lsp_cpp_ravi\\cmake-build-debug', 'lsp-ravi.exe')
    // );
    let serverModule = ''

    // The debug options for the server
    // --inspect=6009: runs the server in Node's Inspector mode so VS Code can attach to the server for debugging
    let debugOptions = { execArgv: ['--nolazy', '--inspect=6009'] };

    // If the extension is launched in debug mode then the debug server options are used
    // 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: [{ scheme: 'file', language: 'plaintext' }],
        synchronize: {
            // Notify the server about file changes to '.clientrc files contained in the workspace
            fileEvents: workspace.createFileSystemWatcher('**/.clientrc')
        }
    };

    // Create the language client and start the client.
    client = new LanguageClient(
        'languageServerExample',
        'Language Server Example',
        serverOptions,
        clientOptions
    );

    // Start the client. This will also launch the server
    client.start();
}
是否可以使用TCP作为连接模式?

好的,问题解决了

因为我没有打开任何文件夹,所以客户端没有调用“活动”

然后我用了这里的答案[https://github.com/microsoft/vscode-languageserver-node/issues/662]要连接到TCP

好的,问题解决了

因为我没有打开任何文件夹,所以客户端没有调用“活动”

然后我用了这里的答案[https://github.com/microsoft/vscode-languageserver-node/issues/662]连接到TCP