Cannot use Powershell intellisense in Sublime Text 3 with LSP - powershell

my LSP.sublime-settings is below
// Settings in here override those in "LSP/LSP.sublime-settings",
{
"powershell-ls":
{
"command":
[
"powershell.exe",
"-NoLogo",
"-NoProfile",
"-NonInteractive",
"-ExecutionPolicy",
"Bypass",
"-Command",
"C:\\Users\\georg\\Downloads\\PowerShellEditorServices\\PowerShellEditorServices\\Start-EditorServices.ps1",
"-LogPath",
"C:\\Users\\georg\\Downloads\\PowerShellEditorServices\\pses-sublime.log",
"-LogLevel",
"Normal",
"-SessionDetailsPath",
"C:\\Users\\georg\\Downloads\\PowerShellEditorServices\\session.json",
"-FeatureFlags",
"#()",
"-HostName",
"'Sublime Text'",
"-HostProfileId",
"subl",
"-HostVersion",
"1.0.0",
"-AdditionalModules",
"#()",
"-BundledModulesPath",
"C:\\Users\\georg\\Downloads\\PowerShellEditorServices",
"-Stdio"
],
"enabled": true,
"languageId": "powershell",
"scopes":
[
"source.powershell"
],
"syntaxes":
[
"Packages/PowerShell/Support/PowershellSyntax.tmLanguage"
]
}
}
Root location of PowerShellEditorServices:
C:\Users\georg\Downloads\
When I click LSP: Setup language server, message below shows LSP has no built-in configuration for a Powershellsyntax language server
Using Powershell 5.1 on Windows 10 x64, with generated help files.
Link for Powershell config template for Sublime editor:
https://github.com/tomv564/LSP/blob/master/docs/index.md

Any language needs to be added under the clients heading, as per below:
{
"auto_show_diagnostics_panel_level": 2,
"clients":
{
"omnisharp":
{
"command":
[
"/home/tb/prebuilt/omnisharp/OmniSharp.exe", // or eg. /usr/local/opt/omnisharp/run
"-lsp"
],
"enabled": true,
"languageId": "csharp",
"syntaxes": ["Packages/C#/C#.sublime-syntax"],
"scopes":
[
"source.cs"
]
}
}
}

Related

VSCODE Latex, security risk: running with elevated privileges

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.

How to cope with this error while compiling latex with vscode?

I followed several tutorials on the Internet and tried to build a latex environment in vscode. However, after I've installed everything and started running a .tex file, it came up with the following error:
Qt: Untested Windows version 6.2 detected!
xelatex: Bad parameter value.
xelatex: Data: font_mem_size
source code test.tex: (I put it in a folder on desktop)
\documentclass{article}
\begin{document}
Hello World!
\end{document}
I tried Google, but didn't find any effective approach. I also restarted my computer and reinstalled MiKTeX, but nothing changed.
By the way: I installed LaTeX workshop, MiKTeX and Strawberry Perl (just following the tutorial) and added this into the settings.json of vscode.
"latex-workshop.latex.tools": [
{
"name": "xelatex",
"command": "xelatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOCFILE%"
]
},
{
"name": "pdflatex",
"command": "pdflatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOCFILE%"
]
},
{
"name": "bibtex",
"command": "bibtex",
"args": [
"%DOCFILE%"
]
}
],
"latex-workshop.latex.recipes": [
{
"name": "xelatex",
"tools": [
"xelatex"
],
},
{
"name": "pdflatex",
"tools": [
"pdflatex"
]
},
{
"name": "xe->bib->xe->xe",
"tools": [
"xelatex",
"bibtex",
"xelatex",
"xelatex"
]
},
{
"name": "pdf->bib->pdf->pdf",
"tools": [
"pdflatex",
"bibtex",
"pdflatex",
"pdflatex"
]
}
],
"latex-workshop.view.pdf.viewer": "tab",
"latex-workshop.latex.autoBuild.run": "onFileChange",
"latex-workshop.message.error.show": false,
"latex-workshop.message.warning.show": false,
Update: the issue was solved by reinstalling MiKTeX and resetting its environment variables in PATH.
The issue was eventually solved by reinstalling MiKTeX and resetting its environment variables in PATH. (Another way is to directly install MiKTeX in its recommended directory, which is how I solved the problem.) In addition, the code I added in the settings.json should be discarded (or vscode will report errors).

Use built-in Octicons in editor/title menu for vscode extension command contribution point

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"
}
]
},

The errors do not show on VS Code

I'm setting up my VS Code for C++. I use version 1.31.1 x64 on windows 10, install C/C++ extension version 0.21.0. Below are my settings:
c_cpp_properties.json
{
"configurations": [
{
"name": "MinGW",
"includePath": [
"${workspaceFolder}/**",
"C:/MinGW/lib/gcc/mingw32/8.2.0/include/**"
],
"defines": [
"LOCAL"
],
"cStandard": "c11",
"cppStandard": "c++14",
"intelliSenseMode": "clang-x64",
"compilerPath": "C:/MinGW/bin/g++.exe"
}
],
"version": 4
}
task.json
{
"version": "2.0.0",
"tasks": [
{
"label": "C++ compile and run",
"type": "shell",
"command": "g++ \"${file}\" -O2 -static -std=c++14 -DLOCAL -o \"${fileDirname}/${fileBasenameNoExtension}.exe\" && \"${fileDirname}/${fileBasenameNoExtension}.exe\"",
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"clear": true,
"echo": false,
"panel": "shared"
}
}
]
}
My simple test program:
#include <iostream>
using namespace std;
int main() {
cout << "hello world"
}
I ran the code by above task. The code was missing a semicolon, but the errors were just shown in terminal tab, while nothing appears in problems tab, also on text editor. Did i miss something?
I found the setting to turn on the error squiggles:
Preferences -> Setting -> search for Intellisense -> choose Enable in C_Cpp: Error Squiggles.
You should check both User settings and Workspace settings.

Is it possible to pass arguments to a task in Visual Studio Code

Here's an example of my tasks.json:
{
"version": "0.1.0",
"tasks": [
{
"taskName": "test",
"suppressTaskName": true,
"command": "python",
"args": [
"tests/brewer_tests.py"
],
"isTestCommand": true
}
]
}
I can run this with shift+cmd+alt+b. I can also run it with alt+t, and choose it from the menu. Is it possible to pass additional arguments in that menu? e.g.
And you could build it into your task like so:
{
"version": "0.1.0",
"tasks": [
{
"taskName": "test",
"suppressTaskName": true,
"command": "python",
"args": [
"tests/brewer_tests.py",
$arg1 # would resolve to "ARG1"
],
"isTestCommand": true
}
]
}
Or something similar?
I used the solution from this answer until now, but since Visual Studio Code has now an official support for task prompts I will add it as an answer here.
In your tasks.json file, you add the key inputs next to your tasks. This key contains an array with all possible parameters. Note that not every task has to use all of these inputs.
All of these inputs have an id, which you will use to reference the input in your task.
Now, in the task you only need to add ${input:myInputId} whereever you need the parameter.
Example:
{
"version": "2.0.0",
"tasks": [
{
"label": "Echo param",
"type": "shell",
"command": "echo ${input:param1}",
"problemMatcher": []
},
{
"label": "Echo without param",
"type": "shell",
"command": "echo Hello",
"problemMatcher": []
},
],
"inputs": [
{
"id": "param1",
"description": "Param1:",
"default": "Hello",
"type": "promptString"
},
]
}
The task Echo param will open a prompt, which lets you input a string value and it will then print this value. The task Echo without param will simply print "Hello".
Here's what is working for me for now - using this to run a golang snippet with custom arguments.
If you add a keyboard mapping to this, the process is very straightforward.
So far tested this only under Windows - linux version is commented out for that reason
{
"label": "runwithargs",
"type": "shell",
"windows": {
"options": {
"shell": {
"executable": "powershell.exe",
"args": [
"-NoProfile",
"-ExecutionPolicy",
"Bypass",
"-Command"
]
}
},
"command": "",
"args": [
{ "value": "$cmdargs = read-host 'Enter command line arguments';", "quoting": "weak"},
{ "value": "go run ${file} $cmdargs", "quoting": "weak"}
]
},
/*"linux": {
"command": "echo 'Enter command line arguments: '; read cmdargs;",
"args": [ "go run ${file} $cmdargs" ]
},*/
"presentation": {
"panel": "dedicated",
"focus": true
}
}
Regarding Input variables, VSCode 1.43 (Feb. 2020) adds a new feature:
promptString Password Input
The "promptString" "input" type can have "password": true, which will cause the quick input that shows to obscure the typed content like a password.