无法让编辑器环绕在vscode语言扩展中工作

时间:2018-10-11 03:54:16

标签: visual-studio-code vscode-extensions

我在VS Code中添加了ISPC(英特尔SPMD编译器)语言支持,但遇到了问题。我无法使周围环境正常工作。我已经在package.json的贡献部分中添加了configurationDefaults,并且添加了一个包含方括号,autoClosingPairs和周围的对部分的语言配置文件。

我也尝试过全局设置编辑器设置,但是无论我做什么,选择都会被删除并替换为方括号/引号/注释字符。希望我在这里做错了。预先感谢您的帮助。

vscode版本-1.28.0

package.json

"contributes": {
    "languages": [
      {
        "id": "ispc",
        "aliases": ["Intel® SPMD Program Compiler", "ISPC", "Volta"],
        "extensions": [".ispc", ".isph" ],
        "configuration": "./ispc.configuration.json"
      }
    ],

    "grammars": [
      {
          "language": "ispc",
          "scopeName": "source.ispc",
          "path": "./ispc.tmLanguage"
      }
    ],

      "snippets": [
      {
          "language": "ispc",
          "path": "./ispc-snippets.json"
      }
    ],

    "configuration": {
      "type": "object",
      "title": "ISPC ",
      "properties": {
        "ispc.maxNumberOfProblems": {
          "type": "number",
          "default": 100,
          "description": "Controls the maximum number of problems returned by the server."
        },
        "ispc.trace.server": {
          "type": "string",
          "enum": [
            "off",
            "messages",
            "verbose"
          ],
          "default": "off",
          "description": "Traces the communication between VSCode and the ISPC language server."
        }
      }
    },

    "configurationDefaults": {
         "[ispc]": {
             "editor.autoClosingBrackets": "always",
             "editor.autoClosingQuotes": "always",
             "editor.autoSurround": "brackets"
        }
    }
},

ispc.configuration.json

{
    "comments": {
        "lineComment": "//",
        "blockComment": ["/*", "*/"]
    },

    "brackets": [
        ["{", "}"],
        ["[", "]"],
        ["(", ")"]
    ],

    "autoClosingPairs": [
        { "open": "[", "close": "]" },
        { "open": "{", "close": "}" },
        { "open": "(", "close": ")" },
        { "open": "'", "close": "'", "notIn": ["string", "comment"] },
        { "open": "\"", "close": "\"", "notIn": ["string"] }
    ],

    "surroundingPairs": [
        ["{", "}"],
        ["[", "]"],
        ["(", ")"],
        ["\"", "\""],
        ["'", "'"],
        ["<", ">"]
    ]
}

1 个答案:

答案 0 :(得分:0)

我能够解决这个问题。我在配置文件名中有一个错字。

"configuration": "./ispc.configuration.json"

应该是:

"configuration": "./ispc-configuration.json"

现在一切正常。