我在两台机器之间设置了远程 SSH 连接,看起来很棒。我可以通过集成终端导航目录结构,打开远程工作区,并使用 CTRL+P 打开文件以搜索工作空间中的文件。但是,如果我尝试通过集成终端从远程系统打开文件到本地 VSCode 实例,则不会发生任何情况。code file.txt是一个无操作,而我想在当前的本地窗口中打开该文件。
我正在使用 VSCode 远程开发在 Docker 容器内运行和调试 django 项目。在我的中devcontainer.json我转发了端口8000
"forwardPorts": [8000],
Run Code Online (Sandbox Code Playgroud)
这是我的launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Django",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/myapp/manage.py",
"args": [
"runserver",
"0.0.0.0:8000"
],
"django": true
}
]
}
Run Code Online (Sandbox Code Playgroud)
当我使用这样的配置开始调试时,我看到转发了 4 个端口:端口 8000 和其他 3 个随机高端口
8000 -> localhost:8000 (the only one I'd expect to see)
34075 -> 127.0.0.1:34075
37301 -> 127.0.0.1:37301
42129 -> 127.0.0.1:42129
Run Code Online (Sandbox Code Playgroud)
我想知道为什么这三个端口被转发以及如何避免它。
Ubuntu我已使用 Windows连接到远程主机VS Code并使用它进行远程开发。我经常在 VS Code 中打开不同的代码存储库,但每次我都必须打开不同的文件夹,尽管已建立连接,VS Code 仍会要求输入密码。
似乎一旦我们对远程主机进行了评论,那么从同一主机连续打开不同的文件夹就不会提示输入密码。
我是否缺少或应该执行任何设置来解决此问题或保存密码。
我正在使用 VSCode devcontainers,如何在 devcontainers.json 中拥有一个兼容 Windows 和 MAC 的安装部分?source=...我在访问该部分下的部分时遇到问题"mounts"。
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.106.0/containers/python-3
{
"name": "Python 3",
"context": "..",
"dockerFile": "Dockerfile",
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"python.pythonPath": "/usr/local/bin/python",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.linting.pylintPath": "venv/bin/pylint",
},
// Change <username> to user path (Ex. /Users/vfrank/ on a MAC)
"mounts": [
"source=<full home path>/.aws/credentials,target=/home/vscode/.aws/credentials,type=bind,consistency=cached"
],
// Add the IDs of extensions …Run Code Online (Sandbox Code Playgroud) 我正在尝试在我没有 root 访问权限的服务器上使用 VS:Code 的远程工作区功能。我仅限于 8192 个观察者,VS:code 使用所有这些观察者,因为我的构建目录中有很多文件。我真的不太需要文件监视,所以我想知道是否有人知道禁用它的简单方法。我尝试添加:
"files.watcherExclude": {
"**/**": true,
"**/*/**": true,
Run Code Online (Sandbox Code Playgroud)
我的用户和远程设置,但它仍在尝试观看所有内容。有谁知道这个问题的解决方案?
谢谢!
我希望在开发容器中运行一个应用程序、数据库和 Redis 服务,这样我就能够在容器、应用程序和 Windows 上访问我的数据库和 Redis,这就是当前我想要的应用程序的工作方式和数据库:
.devcontainer.json:
{
"name": "Node.js, TypeScript, PostgreSQL & Redis",
"dockerComposeFile": "docker-compose.yml",
"service": "akira",
"workspaceFolder": "/workspace",
"settings": {
"typescript.tsdk": "node_modules/typescript/lib",
"sqltools.connections": [
{
"name": "Container database",
"driver": "PostgreSQL",
"previewLimit": 50,
"server": "database",
"port": 5432,
"database": "akira",
"username": "ailuropoda",
"password": "melanoleuca"
}
],
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": true
}
},
"extensions": [
"aaron-bond.better-comments",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"mtxr.sqltools",
"mtxr.sqltools-driver-pg",
"redhat.vscode-yaml"
],
"forwardPorts": [5432],
"postCreateCommand": "npm install",
"remoteUser": "node"
}
Run Code Online (Sandbox Code Playgroud)
docker-compose.yml:
version: "3.8"
services:
akira:
build:
context: …Run Code Online (Sandbox Code Playgroud) 我正在使用 vscode 在服务器上进行远程开发。虽然我的本地 ssh 工作完美,并且 vscode 也能够连接,但我无法理解为什么它在获取锁方面遇到困难:
[15:30:21.166] Log Level: 2
[15:30:21.167] remote-ssh@0.76.1
[15:30:21.167] linux x64
[15:30:21.170] SSH Resolver called for "ssh-remote+myservername", attempt 1
[15:30:21.170] "remote.SSH.useLocalServer": true
[15:30:21.170] "remote.SSH.path": undefined
[15:30:21.170] "remote.SSH.configFile": undefined
[15:30:21.170] "remote.SSH.useFlock": true
[15:30:21.170] "remote.SSH.lockfilesInTmp": false
[15:30:21.171] "remote.SSH.localServerDownload": auto
[15:30:21.171] "remote.SSH.remoteServerListenOnSocket": false
[15:30:21.171] "remote.SSH.showLoginTerminal": false
[15:30:21.171] "remote.SSH.defaultExtensions": []
[15:30:21.171] "remote.SSH.loglevel": 2
[15:30:21.171] "remote.SSH.enableDynamicForwarding": true
[15:30:21.171] "remote.SSH.enableRemoteCommand": false
[15:30:21.173] "remote.SSH.serverPickPortsFromRange": {}
[15:30:21.173] "remote.SSH.serverInstallPath": {}
[15:30:21.182] SSH Resolver called for host: myservername
[15:30:21.182] Setting up SSH remote "myservername"
[15:30:21.185] …Run Code Online (Sandbox Code Playgroud) 我在 macOS 上使用 VSCode,通过 ssh 进入 Linux 远程站,并在此处运行 tmux(在 VSCode 集成终端内)。但是,这样使用时,我无法将 tmux 中的任何文本复制到系统剪贴板中。我什至无法使用鼠标选择文本 - 当我选择任何文本时,选择突出显示会立即消失。
如果满足以下条件,则可以复制到系统剪贴板:
如何从 VSC 集成终端内的 tmux 复制文本?
目前正在尝试使用 devcontainer 来整合 VScode 中后端和前端的开发工作流程,而不是后端使用 InteliJ,前端使用 VScode,同时考虑到使用 Codespace/Gitpod,目标是简化整个堆栈的调试。
我已经阅读了 VScode 中 gradle 的多个教程,并最终找到了可以构建和运行的内容,但是调试器不起作用,而且我没有找到任何教程来处理该部分。
迄今为止最好的结果是使用以下任务和 VScode 的 Gradle 扩展:
{
"type": "gradle",
"id": "/workspaces/mycode/serverrunMyCode",
"script": "run",
"description": "Runs this project as a JVM application",
"group": "application",
"project": "MyCode",
"buildFile": "/workspaces/mycode/server/build.gradle.kts",
"rootProject": "MyCode",
"projectFolder": "/workspaces/mycode/server",
"workspaceFolder": "/workspaces/mycode/server",
"args": "",
"javaDebug": true,
"problemMatcher": [
"$gradle"
],
"label": "Server Debug"
}
Run Code Online (Sandbox Code Playgroud)
服务器通过 VScode 正确构建并运行,但调试器不起作用。
我尝试过 Kotlin 扩展和以下启动设置,但在这里我遇到了缺少依赖项的问题
"configurations": [
{
"type": "kotlin",
"request": "launch",
"name": "Kotlin Launch",
"projectRoot": "${workspaceFolder}",
"mainClass": "io.mycode.ServerKt"
}
]
Run Code Online (Sandbox Code Playgroud)
依赖错误: …
gradle kotlin visual-studio-code vscode-debugger vscode-remote
我想使用SSH运行运行Raspbian GNU / Linux 9(拉伸)的Raspberry Pi 3 Model B +运行Visual Studio Code Remote Development。
我尝试遵循“入门”说明。我运行命令Remote-SSH: Connect to Host...,但收到消息Can't connect to admin@pihole.local: unreachable or not Linux x86_64 (Linux armv7l )
据我所知,Raspbian是32位的。那么,这是否意味着我要实现的目标是不可能的?
我可以在命令行上使用ssh连接到Raspberry Pi,而不会出现问题(不是基于密码)。我正在macOS Mojave 10.14.4上运行VS Code内部人员。
raspberry-pi raspbian visual-studio-code raspberry-pi3 vscode-remote
vscode-remote ×10
docker ×2
django ×1
gradle ×1
kotlin ×1
macos ×1
raspberry-pi ×1
raspbian ×1
tmux ×1
zsh ×1