我应该如何将我的语言服务器与我的客户端打包? [英] How should I package my Language Server with my client?
问题描述
我正在尝试为 VSCode 创建语言服务器.它由客户端和服务器组成,通过 RPC 进行通信.
I'm trying to create a language server for VSCode. It's made up of a client and a server, communicating over RPC.
官方文档有一个工作示例,带有语言-server 分成两个目录,client
和 server
.
The official docs have a working example, with the language-server split into in two directories, the client
and the server
.
我想要做的是将两者打包成一个 VSIX 文件,这样我就可以将它们安装在一起.
What I want to do is to package both into a VSIX file, so I can install them together.
在他们的示例中,他们对 client
目录说 cd
并运行 vsce package
.但是,如果我这样做并安装结果包,VSCode 会说
In their example, they say cd
to the client
directory and run vsce package
. However, If I do that and install the resultant package, VSCode says
错误:找不到模块'/home/blah/vscode.language-client-example-0.0.1/server/server.js"
"Error: Cannot find module '/home/blah/vscode.language-client-example-0.0.1/server/server.js"
我无法在 server
目录中运行 vsce 包
,因为它抱怨
I can't run vsce package
in the server
directory, as it complains
错误:缺少出版商名称"
"Error: Missing publisher name"
如何打包?
推荐答案
无论是打包还是发布都需要注册一个发布者.
Both for packaging as well as publishing you need to register a publisher.
在文档中,他们解释了如何为自己创建发布者:https://code.visualstudio.com/api/working-with-extensions/publishing-extension#create-a-publisher
In the docs they explain how to create a publisher for yourself: https://code.visualstudio.com/api/working-with-extensions/publishing-extension#create-a-publisher
然后在您的(根)package.json
中添加您的发布者 ID:"publisher": "my-publisher"
Then in your (root) package.json
add your publisher id: "publisher": "my-publisher"
之后 package
和 publish
都应该与 vsce
一起使用.
After that both package
and publish
should work with vsce
.
这篇关于我应该如何将我的语言服务器与我的客户端打包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!