Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

无法在vscode server中使用 #42

Closed
wangzhankun opened this issue Jul 28, 2020 · 17 comments
Closed

无法在vscode server中使用 #42

wangzhankun opened this issue Jul 28, 2020 · 17 comments

Comments

@wangzhankun
Copy link
Contributor

你在什么场景下需要该功能?

我在服务器上部署了vscode web,并安装了xmake插件,但是该插件不能够正常使用,希望能够增加对vscode web的适应性。

  • ubuntu18.04
  • vscode server
    在ubuntu上部署vscode server可以参考该网址,直接下载对应deb包即可完成安装。可通过修改~/.config/code-server/config.yaml绑定相应的ip地址与port。
@waruqi
Copy link
Member

waruqi commented Jul 29, 2020

等有时间 我会看下

@wangzhankun
Copy link
Contributor Author

今天我尝试使用yarn进行安装发现yarn安装的code-server是可以正常使用xmake插件的。deb包安装的code-server运行时则不可以使用xmake插件。

@waruqi
Copy link
Member

waruqi commented Jul 29, 2020

那就跟xmake插件本身没啥关系吧。。

@wangzhankun
Copy link
Contributor Author

wangzhankun commented Jul 29, 2020

但是debug的功能不能正常使用。启动debug之后界面呈现如下:
image

@waruqi
Copy link
Member

waruqi commented Jul 29, 2020

你本机mac? 用codelldb也不行? #26

@wangzhankun
Copy link
Contributor Author

vscode-server是部署在了ubuntu18.04上面,我在Windows下使用edge浏览器使用code-server进行debug发现需要添加配置。当我在ubuntu下面使用vscode进行调试的时候是不需要添加配置文件即可调试的。
image

@waruqi
Copy link
Member

waruqi commented Jul 29, 2020

没这么玩过 回头等空了 我看看

@waruqi
Copy link
Member

waruqi commented Jul 30, 2020

我没linux环境,我在mac下开local host去访问试了下,是可以的没啥问题,唯一的坑就是从market装的cpptools插件os不匹配,我手动从 https://github.com/microsoft/vscode-cpptools/releases 下载对应os版本装了下,其他没啥坑

image

感觉这个跟xmake的插件真没啥关系,点xmake的调试,也就是把target的program file path送入vscode的launch.json里面,让vscode的cpptools调试器自动加载,其他都是vscode和cpptools的事情。。你自己再研究下吧

@wangzhankun
Copy link
Contributor Author

wangzhankun commented Jul 30, 2020

json文件

请问launch.json文件和tasks.json文件像下面这么写正确吗?

{
    // 使用 IntelliSense 了解相关属性。 
    // 悬停以查看现有属性的描述。
    // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "debug",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/../build/chat_application",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "cmake_debug",
            "miDebuggerPath": "/usr/bin/gdb"
        },
        
    ]
}
{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "shell",
            "label": "debug",
            "command": "xmake f -p linux -m debug && xmake && xmake r",
            "args": [],
            "options": {
                "cwd": "${workspaceFolder}"
            }
        },
        {
            "type": "shell",
            "label": "release",
            "command": "xmake f -p linux -m release && xmake && xmake r",
            "args": [],
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "problemMatcher": [
                "$gcc"
            ]
        }
      
    ]
}

问题一

点击debug按钮之后一直显示如下效,就红框框住的进度条没有任何反应:
image

问题二

另外请问为什么在本地进行调试的时候不需要写json配置文件也能正常debug呢?

@wangzhankun
Copy link
Contributor Author

我在本地进行测试之后,json文件应该是没有吗问题的,只是在云端无法正常使用。另外请问你的vscode-server是自行编译部署的还是在我提供的链接里面的项目进行部署的呢?
image

@waruqi
Copy link
Member

waruqi commented Jul 30, 2020

请问launch.json文件和tasks.json文件像下面这么写正确吗?

外置的配置我没写过,你自己研究下官方文档吧

点击debug按钮之后一直显示如下效,就红框框住的进度条没有任何反应:

这个就不清楚了,反正我这ok

另外请问为什么在本地进行调试的时候不需要写json配置文件也能正常debug呢?

插件里面会直接拼接相关launch的配置传给cpptools调试器,所以不需要自己写

} else if (os.platform() == "linux") {
debugConfig = {
name: `launch: ${targetName}`,
type: 'cppdbg',
request: 'launch',
program: targetProgram,
args: args,
stopAtEntry: true,
cwd: targetRunDir,
environment: [],
externalConsole: false, // @see https://github.com/xmake-io/xmake-vscode/issues/36
MIMode: "gdb",
miDebuggerPath: "",
description: "Enable pretty-printing for gdb",
text: "-enable-pretty-printing",
ignoreFailures: true

当然内置的launch/debugger配置,也可以在用户配置中自定义重写的,具体看下 #19

@waruqi
Copy link
Member

waruqi commented Jul 30, 2020

另外请问你的vscode-server是自行编译部署的还是在我提供的链接里面的项目进行部署的呢?

直接从code server的 releases下 下载 bin 直接运行的

@wangzhankun
Copy link
Contributor Author

那有可能是环境不同导致的。如果有时间的话,你在ubuntu18.0 x86平台下部署测试一下吧,我再试试在ubuntu下面安装release文件运行看看正常不。另外我在树莓派4b下进行部署debug遇到了如下问题:
image

@waruqi
Copy link
Member

waruqi commented Jul 30, 2020

我没树莓派,没法测试,你可以参考 #19 的方式,改写下内部的 launch/debugConfig 来测试

"xmake.customDebugConfig": {
  "type": "cppdbg",
  "program": "xxxx"
  ... 其他所有配置
}

或者直接加载xmake-vscode源码,调试下 下面的代码

} else if (os.platform() == "linux") {
debugConfig = {
name: `launch: ${targetName}`,
type: 'cppdbg',
request: 'launch',
program: targetProgram,
args: args,
stopAtEntry: true,
cwd: targetRunDir,
environment: [],
externalConsole: false, // @see https://github.com/xmake-io/xmake-vscode/issues/36
MIMode: "gdb",
miDebuggerPath: "",
description: "Enable pretty-printing for gdb",
text: "-enable-pretty-printing",
ignoreFailures: true

@wangzhankun
Copy link
Contributor Author

你在什么场景下需要该功能?

我在服务器上部署了vscode web,并安装了xmake插件,但是该插件不能够正常使用,希望能够增加对vscode web的适应性。

  • ubuntu18.04
  • vscode server
    在ubuntu上部署vscode server可以参考该网址,直接下载对应deb包即可完成安装。可通过修改~/.config/code-server/config.yaml绑定相应的ip地址与port。

对了,想起来了,因为在ubuntu18.04 x86_64下使用code-server的release包不能使用xmake插件所以改成了yarn安装。希望这个问题能够解决一下。关于树莓派的cppdbg问题应该是平台原因跟xmake插件无关,之后在本地解决问题之后会进行反馈以便于修改插件中的json配置。ubuntu18.04 x86_64平台下yarn安装的code-server确实无法正常调试,之后会向code-server项目提交issue。

@waruqi
Copy link
Member

waruqi commented Jul 30, 2020

对了,想起来了,因为在ubuntu18.04 x86_64下使用code-server的release包不能使用xmake插件所以改成了yarn安装。希望这个问题能够解决一下

这是code server的问题吧,跟xmake有啥关系,既然yarn装的可以,说明xmake没啥问题。。而且我这也没ubuntu环境做测试

@wangzhankun
Copy link
Contributor Author

已经移交到code-server的issue了。树莓派的问题是因为vscode-cpptools extension目前不支持arm平台。非常感谢你的耐心解答。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants