Skip to content

Put the setLanguageConfiguration code in the appropriate place #1349

Open
@rjmholt

Description

@rjmholt

Currently main.ts is mostly populated with this mystifying code blob:

vscode.languages.setLanguageConfiguration(
PowerShellLanguageId,
{
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\=\+\[\{\]\}\\\|\;\'\"\,\.\<\>\/\?\s]+)/g,
indentationRules: {
// ^(.*\*/)?\s*\}.*$
decreaseIndentPattern: /^(.*\*\/)?\s*\}.*$/,
// ^.*\{[^}"']*$
increaseIndentPattern: /^.*\{[^}"']*$/,
},
comments: {
lineComment: "#",
blockComment: ["<#", "#>"],
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"],
],
onEnterRules: [
{
// e.g. /** | */
beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
afterText: /^\s*\*\/$/,
action: { indentAction: vscode.IndentAction.IndentOutdent, appendText: " * " },
},
{
// e.g. /** ...|
beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
action: { indentAction: vscode.IndentAction.None, appendText: " * " },
},
{
// e.g. * ...|
beforeText: /^(\t|(\ \ ))*\ \*(\ ([^\*]|\*(?!\/))*)?$/,
action: { indentAction: vscode.IndentAction.None, appendText: "* " },
},
{
// e.g. */|
beforeText: /^(\t|(\ \ ))*\ \*\/\s*$/,
action: { indentAction: vscode.IndentAction.None, removeText: 1 },
},
{
// e.g. *-----*/|
beforeText: /^(\t|(\ \ ))*\ \*[^/]*\*\/\s*$/,
action: { indentAction: vscode.IndentAction.None, removeText: 1 },
},
],
});

It seems to have some PowerShell related bits in it, but also some JS doc comment stuff...

It probably shouldn't be in main.ts, and we should work out if it even causes anything. I suspect it's getting ignored in favour of the code in https://github.com/Microsoft/vscode/blob/master/extensions/powershell/language-configuration.json.

We should investigate and:

  • if the code here is being preferred, move it to a more sensible location in the repo and make sure it's up to do
  • if the VSCode JSON is being preferred, delete this code

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions