I'm not sure if it was a recent update, but for some reason I'm not getting the quick fixes for ESLint any longer. It will say "Checking for quick fixes...", but I will not display any. In the ESLint server I can see the fix available, but the command is missing in VS Code.
[Trace - 5:30:49 PM] Received response 'textDocument/codeAction - (13)' in 0ms.
Result: [
{
"title": "Disable no-unused-vars for this line",
"command": {
"title": "Disable no-unused-vars for this line",
"command": "eslint.applyDisableLine",
"arguments": [
{
"uri": "file:///d%3A/Development/sfdx/insider/force-app/main/default/lwc/apexImperativeMethod/apexImperativeMethod.js",
"version": 14,
"ruleId": "no-unused-vars"
}
]
},
"kind": "quickfix"
},
{
"title": "Disable no-unused-vars for the entire file",
"command": {
"title": "Disable no-unused-vars for the entire file",
"command": "eslint.applyDisableFile",
"arguments": [
{
"uri": "file:///",
"version": 14,
"ruleId": "no-unused-vars"
}
]
},
"kind": "quickfix"
},
{
"title": "Show documentation for no-unused-vars",
"command": {
"title": "Show documentation for no-unused-vars",
"command": "eslint.openRuleDoc",
"arguments": [
{
"uri": "file:///",
"version": 14,
"ruleId": "no-unused-vars"
}
]
},
"kind": "quickfix"
}
]
Same was happening to me as well and after trying multiple things what worked for me was a clean reinstall of Code which meant uninstalling Code, deleting the extension folder and and installing the code followed by extensions. And quick fix is back.
Related
Environment:
OS: Window 10,x64
VSCode: 1.69.1
Related VSCode Plugins installed: LaTeX,LaTeX Workshop,LaTeX Utilities,LaTeX language support
Latex: MiKTeX 21.12.10 Portable
The VSCode Configuration is below
"latex-workshop.latex.recipes": [
{
"name": "pdflatex -> bibtex -> pdflatex*2",
"tools": ["pdflatex", "bibtex", "pdflatex","pdflatex"]
},
{
"name": "xelatex",
"tools": ["xelatex"]
},
{
"name": "latexmk",
"tools": ["latexmk"]
},
],
"latex-workshop.latex.tools": [
{
"name": "latexmk",
"command": "latexmk",
"args": ["-synctex=1","-interaction=nonstopmode","-file-line-error","-pdf","-outdir=./output","%DOCFILE%"]
},
{
"name": "xelatex",
"command": "xelatex",
"args": [ "-synctex=1","-interaction=nonstopmode","-file-line-error","-output-directory=./output","%DOCFILE%"]
},
{
"name": "pdflatex",
"command": "pdflatex",
"args": [ "-synctex=1","-interaction=nonstopmode","-file-line-error","-output-directory=./output","%DOCFILE%"]
},
{
"name": "bibtex",
"command": "bibtex",
"args": [ "./output/%DOCFILE%"]
},
],
"latex-workshop.view.pdf.viewer": "tab",
"latex-workshop.latex.clean.fileTypes": [
"*.aux",
"*.bbl",
"*.blg",
"*.idx",
"*.ind",
"*.lof",
"*.lot",
"*.out",
"*.toc",
"*.acn",
"*.acr",
"*.alg",
"*.glg",
"*.glo",
"*.gls",
"*.ist",
"*.fls",
"*.log",
"*.fdb_latexmk"
],
"latex-workshop.latex.autoClean.run": "never",
"latex-workshop.latex.recipe.default": "first",
"latex-workshop.view.pdf.external.viewer.args": [
"./output/%PDF%"
],
"latex-workshop.latex.outDir": "./output",
I use VSCode to write latex. And it occurs the errors below:
chktex: security risk: running with elevated privileges
Cannot count words, code: 4294967295, texcount: security risk: running with elevated privileges
How to solve it?
I have tried to run VSCode with administrator, but it didn't help.
I solved it.
Only the plugin LaTeX Workshop is needed. Other plugins(LaTeX,LaTeX Utilities,LaTeX language support) can be uninstalled.
When writing an extension in vsCode, is it possible to create a configuration (a field in my settings.json) where I can store multiple values and configure an actively selected one?
Say I have an external dependency, which I need to reference in my tasks.json. Through the configuration contribution point of the extension i can provide the following property:
"myextension.dependencyDir": {
"scope": "resource",
"type": "string",
"description": "Path to the external dependency"
}
I can now reference this path in my tasks.json through ${config:myextension.dependencyDir}
However, lets say my dependency comes in various versions, which I would like to switch from the comfort of my settings(UI)
I know that by using an array I can store multiple versions of the dependency.
"myextension.dependencyDir": {
"scope": "resource",
"type": "array",
"items": {
"type": "string"
},
"description": "Path to the external dependency"
},
However, I cannot seem to reference single elements out of this array from my tasks.json.
By calling ${config:myextension.dependencyDir} now, i get the entire array.
I have tried to call
${config:myextension.dependencyDir[0]}
${config:myextension.dependencyDir(0)}
${config:myextension.dependencyDir:0}
... and many other variations
to query the first item in my array. Neigther of those attempts have worked.
${config:myextension.dependencyDir}[0] just appends '[0]' to the
last element.
I know that I can create custom objects and configure them in my settings.
"myextension.dependencyDir": {
"scope": "resource",
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Name of your dependency version"
},
"value": {
"type": "string",
"description": "Path to the specific Dependency version"
}
}
},
"description": "Path to the external dependency"
},
However, just like before, I don't know how to access a single entry in my array, let alone adress the specific fields name and value.
Is what I am trying to do possible? Is it even the proper way of doing this? Does anyone have a solution to my problem or suggestions for a different approach?
Thanks in advance
BioZons
You can use the extension Command Variable v1.30.0
It has a command extension.commandvariable.config.expression. It allows to apply a JavaScript expression to the value of a configuration variable.
If the config variable is an array:
{
"version": "2.0.0",
"tasks": [
{
"label": "echo config var",
"type": "shell",
"command": "echo",
"args": [
"ConfigArray: ${input:configArray}",
],
"problemMatcher": []
}
],
"inputs": [
{
"id": "configArray",
"type": "command",
"command": "extension.commandvariable.config.expression",
"args": {
"configVariable": "myextension.dependencyDir",
"expression": "content[1]"
}
}
]
}
If the config variable is an array and you want to pick the array element:
{
"version": "2.0.0",
"tasks": [
{
"label": "echo config var",
"type": "shell",
"command": "echo",
"args": [
"ConfigArrayPick: ${input:configArrayPick}",
],
"problemMatcher": []
}
],
"inputs": [
{
"id": "configArrayPick",
"type": "command",
"command": "extension.commandvariable.config.expression",
"args": {
"configVariable": "myextension.dependencyDir",
"expression": "content[${pickStringRemember:serverNr}]",
"pickStringRemember": {
"serverNr": {
"description": "Which server to use?",
"options": [
["development", "0"],
["live", "1"]
]
}
}
}
}
]
}
If the config variable is an array of objects:
{
"version": "2.0.0",
"tasks": [
{
"label": "echo config var",
"type": "shell",
"command": "echo",
"args": [
"ConfigObject: ${input:configObject}",
],
"problemMatcher": []
}
],
"inputs": [
{
"id": "configObject",
"type": "command",
"command": "extension.commandvariable.config.expression",
"args": {
"configVariable": "myextension.dependencyDir",
"expression": "content[1].name"
}
}
]
}
I am trying to create a new VS Code theme, but whenever I try to run the debugger vs code shows a warning "You don't have an extension for debugging 'JSON with comments'. Should we find a 'JSON with comments' extension in the marketplace?'
My launch.json file:
{
"version": "0.2.0",
"configurations": [
{
"name": "Extension",
"type": "extensionHost",
"request": "launch",
"args": ["--extensionDevelopmentPath=${workspaceFolder}"]
}
]
}
My package.json file:
{
"name": "theme",
"displayName": "theme",
"description": "theme",
"version": "0.0.1",
"engines": {
"vscode": "^1.58.0"
},
"categories": [
"Themes"
],
"contributes": {
"themes": [
{
"label": "theme",
"uiTheme": "vs-dark",
"path": "./themes/theme-color-theme.json"
}
]
}
}
I tried finding the JSON with comments debugger in the marketplace, but couldn't find it. Does anyone has any idea what I am doing wrong?
When debugging a theme your "./.vscode/launch.json" should look like this:
// "./.vscode/launch.json"
{
"configurations": [
{
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"name": "Launch Extension",
"request": "launch",
"type": "pwa-extensionHost"
}
]
}
"You only need four (4) settings total, which are displayed in the snippet above. Everything else is unnecessary junk when debugging a theme."
You need to do one more thing:
At the very top of your "./themes/theme-color-theme.json" file add the following lines:
// "./themes/theme-color-theme.json"
{
"name": "Your-themes-name",
"type": "dark",
"$schema": "vscode://schemas/color-theme",
"colors": {
// theme highlighting...
},
}
EDIT:
I unintentionally added "semanticHighlighting": true to the snippet above. That's something that isn't related to this question so I removed it from the example. Semantic Highlight is important, though, and you should read about it before choosing true or false, if you haven't read about it already.
Is it possible to use Octitons that ship with vscode without embedding it into my extension?
"contributes": {
"commands": [
{
"command": "my.extraordinary.command",
"title": "My command",
"icon":{
"dark": "<what should go here?>",
"light": "<what should go here?>"
}
},
],
"menus": {
"editor/title": [
{
"command": "my.extraordinary.command",
"group": "navigation"
}
]
},
I am building a VS Code extension starting from this page. Now I want to hide in the palette menu the command extension.timerStart after I run it. I have read this page, didn't helped. I have the code bellow for package.json. How do I make the varFromMyExtension===false part work?
"contributes": {
"commands": [
{
"command": "extension.timerStart",
"title": "Timer Start"
}
],
"menus": {
"commandPalette": [
{
"command": "extension.timerStart",
"when": "varFromMyExtension===false"
}
]
}
I think it is not possible to access variables from your extension directly in a when clause. However you can access any configuration of the settings.json.
From the docs (at the bottom of the chapter):
Note: You can use any user or workspace setting that evaluates to a boolean here with the prefix "config.".
So when your extension contributes a boolean configuration called varFromMyExtension you should be able to use it in the when clause. This configuration then can be manipulated programmatically, too.
So your package.json would probably contain something like this (not tested):
"contributes": {
"commands": [
{
"command": "extension.timerStart",
"title": "Timer Start"
}
],
"menus": {
"commandPalette": [
{
"command": "extension.timerStart",
"when": "!config.myextension.varFromMyExtension"
}
]
},
"configuration": {
"type": "object",
"title": "Indicates whether ...",
"properties": {
"myextension.varFromMyExtension": {
"title": "My title.",
"description": "My description",
"type": "boolean",
"default": false,
"pattern": "(true|false)"
}
}
}
}
But bare in mind that the user can see and edit this setting, too.