标签: visual-studio-code

如何使用打字稿同步 eslint 或设置类似的 tslint 和 prettier?

我有一个现有的 React/Redux 项目,并且我已经开始在我的项目中使用 typescript。我已经为扩展airbnbeslint 配置的项目设置了我的eslint 配置。我的 eslint 如下:

module.exports = {
  "parser": "babel-eslint",
  "extends": [
    "airbnb",
    "plugin:flowtype/recommended"
  ],
  "plugins": [
    "react",
    "jsx-a11y",
    "flowtype"
  ],
  "env": {
    "browser": true,
    "node": true,
    "es6": true
  },
  "globals": {
    "__DEV__": true,
    "__SERVER__": true,
    "__": true,
    "define": true,
    "describe": true,
    "expect": true,
    "require": true,
    "test": true,
  },
  "ecmaFeatures": {
    "arrowFunctions": true,
    "binaryLiterals": true,
    "blockBindings": true,
    "classes": true,
    "defaultParams": true,
    "destructuring": true,
    "forOf": true,
    "generators": true,
    "modules": true,
    "objectLiteralComputedProperties": true,
    "objectLiteralDuplicateProperties": true,
    "objectLiteralShorthandMethods": true, …
Run Code Online (Sandbox Code Playgroud)

typescript eslint visual-studio-code prettier

1
推荐指数
1
解决办法
1004
查看次数

vscode 无法识别我的 django 模块应用程序。来自 vscode 的警告

我在 Visual Studio Code 中安装了一些扩展以在 Django 中进行开发。我唯一的问题是当我尝试这样做时;

在 VSCode 中打开文件夹

从 my_app 导入视图

浏览器的完整视图

启动文件

从my_app_name导入视图

我收到了来自 Visual Studio Code 的警告。

如果这样打字;

从. 导入视图

我没有收到任何警告!但是 a 更喜欢上面的另一种形式。

  1. 我的笔记本电脑上安装了 python 3.x。
  2. 我已经创建了 Anaconda 环境。
  3. 我安装了一些扩展程序(Python、Django、Pylint...)

注意:我的项目运行良好,因为这只是一个警告,但我希望该警告消失。

我的快速解决方案:

打开项目文件夹 只需打开一个项目目录。

python django visual-studio-code

1
推荐指数
1
解决办法
3788
查看次数

将 VS 代码菜单栏合并到 Ubuntu(Unity) 默认顶部栏

在上次更新中,我得到了一个新的菜单栏。我使用默认的 Ubuntu 菜单栏,它仅位于顶部的一行。我怎样才能把它拿回来?

在此处输入图片说明

有没有办法摆脱这个菜单栏并将其合并回顶部?

ubuntu visual-studio-code

1
推荐指数
1
解决办法
635
查看次数

在 Chrome 中单击“在文件夹中显示”时阻止打开 Visual Studio Code

我已经在谷歌上搜索了半天了。

当我在 Google Chrome 中下载某些内容时,我想转到包含文件的文件夹。但是当我按“在文件夹中显示”时,会启动 Visual Studio Code 而不是我的 Thunar。我怎样才能解决这个问题?

Firefox 可以打开文件夹,但 Chromium、Google-Chrome 和 Opera 会打开 Visual Studio Code。

我的系统是 Linux Mint Tara。我已经尝试了一些东西。喜欢添加

[Default Applications]
inode/directory=Thunar.desktop
Run Code Online (Sandbox Code Playgroud)

到 /home/[user]/.config/mimeapps.list

code.desktop从 /usr/share/applications/mimeinfo.cache 中完全删除

跑xdg-mime default Thunar.desktop inode/directory了,输出的xdg-mime query default inode/directory是Thunar.desktop!!!

甚至从文件系统中完全删除了 code.desktop。没有任何效果!

请帮忙,这让我很恼火。

google-chrome file-management chromium linux-mint visual-studio-code

1
推荐指数
3
解决办法
2529
查看次数

Intellisense 不工作 golang 测试文件

标题说明了一切。我打开一个测试文件。键入$package.。什么都没有出现。这不是延迟问题。这不是一个空包。如何让智能感知开启?

Update: I've open a bug ticket with the VSCode-Golang team. As we find more information, I'll report back here. https://github.com/Microsoft/vscode-go/issues/2278

For those down voting: please follow the community standard and explain why.

go visual-studio-code

1
推荐指数
1
解决办法
2863
查看次数

VSCODE 准确的按键绑定,想知道当前上下文。怎么做?

许多插件可以通过未公开的API SetContext设置自己特定的“上下文” 。由于文档没有列出这些自定义上下文,我不能只查看文档以了解如何以正确的方式配置我自己的键绑定。是否有可能知道当前的上下文数组?

例如:我想使用键盘快捷键(无鼠标)导航到“git lens”面板(已经有这个),然后通过键盘导航将一些文件标记为暂存,然后调用提交编辑器,只需'提交' 我的东西。

visual-studio-code

1
推荐指数
1
解决办法
286
查看次数

如何在 macOS 上的 VS Code 终端中自定义 shell 提示

我正在尝试在 vscode 中自定义我的集成终端 shell 提示,并且成功地能够更改主题(以便我可以看到我当前的工作目录和我所在的分支),但是现在我想删除第一部分' anhlucci@Anhs-MacBook-Pro'。我怎么做?

在此处输入图片说明

terminal visual-studio-code

1
推荐指数
1
解决办法
2991
查看次数

如何在 vscode 中为 cppcheck 任务定义问题匹配器?

我正在为 vscode 设置一个“cppcheck”任务。它有效,但问题匹配器无法捕获问题。

我尝试过“$gcc”问题匹配器以及一些自定义配置。

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "cppcheck",
            "type": "shell",
            "command": "cppcheck --template=gcc --enable=style --project=${workspaceFolder}/build/compile_commands.json",
            "problemMatcher": "$gcc",
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

或这个:

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "cppcheck",
            "type": "shell",
            "command": "cppcheck --template=gcc --enable=warning src/jc_certreq.cpp",
            "problemMatcher": {
                "owner": "cpp",
                "fileLocation": "absolute",
                "pattern": {
                    "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
                    "file": 1,
                    "line": 2,
                    "column": 3,
                    "severity": 4, …
Run Code Online (Sandbox Code Playgroud)

cppcheck visual-studio-code vscode-tasks

1
推荐指数
1
解决办法
1107
查看次数

Asp.Net 注释导致 VS Code 语法高亮停止工作

VS 代码截图我的.ascx文件包含 C# 和 HTML。VSCode 中的所有内容都正确突出显示语法,直到它到达<%-- insert dynamically generated text here --%>. 之后,一切都像文字一样白。所有 HTML/其他代码都不会突出显示并且 IntelliSense 停止工作。你如何阻止 VSC 这样做?

asp.net syntax-highlighting visual-studio-code

1
推荐指数
1
解决办法
464
查看次数

使用 vue/essential 时,它不会在模板中格式化

我想弄清楚为什么我的设置没有在<template>code</template>. 设置舞台。我一直在使用 Vue cli 3,模板 eslint + 标准,我使用 VS Code,我得到了 Vetur 和 eslint 作为插件。

我想使用@vue/essential配置,但如前所述它没有在模板中格式化,只有 js。现在切换到@vue/recommended模板中的格式。有什么区别?

工作配置

'extends': [
    'plugin:vue/essential',
    'standard'
  ],
Run Code Online (Sandbox Code Playgroud)

不工作

.eslintrc.js

'extends': [
    'plugin:vue/essential',
    'standard'
  ],
Run Code Online (Sandbox Code Playgroud)

其他配置

vscode

"eslint.workingDirectories": [
        ".eslintrc.js"
    ],
    "eslint.enable": true,
    "eslint.run": "onSave",
    "eslint.validate": [
        {
            "language": "vue",
            "autoFix": true
        },
        {
            "language": "html",
            "autoFix": true
        },
        {
            "language": "javascript",
            "autoFix": true
        }
    ],
    "eslint.options": {
        "extensions": [
          ".js",
          ".vue"
        ]
    },
    "eslint.alwaysShowStatus": true,
    "eslint.autoFixOnSave": true,
    "editor.formatOnSave": false, …
Run Code Online (Sandbox Code Playgroud)

eslint vue.js visual-studio-code vetur

1
推荐指数
1
解决办法
1043
查看次数