How to open file from keybindings.json without extensions in vscode? - visual-studio-code

There are some complex commands that can be invoked with args:
{
"key": "ctrl+shift+alt+w",
"command": "vscode.setEditorLayout",
"args": {
"orientation": 0,
"groups": [
{
"groups": [
{},
{}
],
"size": 0.7
},
{
"groups": [
{},
{}
],
"size": 0.3
}
]
}
},
vscode.open appears in command autocomplete and therefore should be able to work. But I cannot find what to pass as args for it to work.
https://code.visualstudio.com/api/references/commands
P.S. I know I can use extensions. Just looking if it's possible or not.

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 do I use Argo Workflows Using Previous Step Outputs As Inputs?

I am trying to format my workflow per these instructions (https://argoproj.github.io/argo-workflows/workflow-inputs/#using-previous-step-outputs-as-inputs) but cannot seem to get it right. Specifically, I am trying to imitate "Using Previous Step Outputs As Inputs"
I have included my workflow below. In this version, I have added a path to the inputs.artifacts because the error requests one. The error I am now receiving is:
ATA[2022-02-28T14:14:45.933Z] Failed to submit workflow: templates.entrypoint.tasks.print1 templates.print1.inputs.artifacts.result.from not valid in inputs
Can someone please tell me how to correct this workflow so that it works?
---
{
"apiVersion": "argoproj.io/v1alpha1",
"kind": "Workflow",
"metadata": {
"annotations": {
"workflows.argoproj.io/description": "Building from the ground up",
"workflows.argoproj.io/version": ">= 3.1.0"
},
"labels": {
"workflows.argoproj.io/archive-strategy": "false"
},
"name": "data-passing",
"namespace": "sandbox"
},
"spec": {
"artifactRepositoryRef": {
"configMap": "my-config",
"key": "data"
},
"entrypoint": "entrypoint",
"nodeSelector": {
"kubernetes.io/os": "linux"
},
"parallelism": 3,
"securityContext": {
"fsGroup": 2000,
"fsGroupChangePolicy": "OnRootMismatch",
"runAsGroup": 3000,
"runAsNonRoot": true,
"runAsUser": 1000
},
"templates": [
{
"container": {
"args": [
"Hello World"
],
"command": [
"cowsay"
],
"image": "docker/whalesay:latest",
"imagePullPolicy": "IfNotPresent"
},
"name": "whalesay",
"outputs": {
"artifacts": [
{
"name": "msg",
"path": "/tmp/raw"
}
]
},
"securityContext": {
"fsGroup": 2000,
"fsGroupChangePolicy": "OnRootMismatch",
"runAsGroup": 3000,
"runAsNonRoot": true,
"runAsUser": 1000
}
},
{
"inputs": {
"artifacts": [
{
"from": "{{tasks.whalesay.outputs.artifacts.msg}}",
"name": "result",
"path": "/tmp/raw"
}
]
},
"name": "print1",
"script": {
"command": [
"python"
],
"image": "python:alpine3.6",
"imagePullPolicy": "IfNotPresent",
"source": "cat {{inputs.artifacts.result}}\n"
},
"securityContext": {
"fsGroup": 2000,
"fsGroupChangePolicy": "OnRootMismatch",
"runAsGroup": 3000,
"runAsNonRoot": true,
"runAsUser": 1000
}
},
{
"dag": {
"tasks": [
{
"name": "whalesay",
"template": "whalesay"
},
{
"arguments": {
"artifacts": [
{
"from": "{{tasks.whalesay.outputs.artifacts.msg}}",
"name": "result",
"path": "/tmp/raw"
}
]
},
"dependencies": [
"whalesay"
],
"name": "print1",
"template": "print1"
}
]
},
"name": "entrypoint"
}
]
}
}
...
In the artifact argument of print1, you should only put name and from parameters
E.g:
- name: print1
arguments:
artifacts: [{name: results, from: "{{tasks.whalesay.outputs.artifacts.msg}}"}]
and then in your template declaration, you should put name and path in your artifact input, as follows:
- name: input1
inputs:
artifacts:
- name: result
path: /tmp/raw
...
This works because in the argument of you task (in the dag declaration) you tell the program how you want that input to be called and from where to extract it, and in the template declaration you receive the input from name and tell the program where to place it temporarily. (This is what I understand in my own words)
Another problem I see is in print1 instead of printing to stdout or using sys to run the cat command, you run cat directly, this (I think) is not posible.
You should instead do something like
import sys
sys.stdout.write("{{inputs.artifacts.result}}\n")
or
import os
os.system("cat {{inputs.artifacts.result}}\n")
A very similar workflow from the Argo developers/maintainers can be found here:
https://github.com/argoproj/argo-workflows/blob/master/examples/README.md#artifacts

Why does VSCode not highlight anything when I use this textMate?

I am writing a logic gate simulator and have decided to make a VSCode extension for the language it uses. So far, I have a folder named lgc that contains the extension. Inside that folder there are the following:
package.json:
{
"name": "Lgc",
"version": "0.1.0",
"engines": {
"vscode": ">=0.9.0-pre.1"
},
"publisher": "AwesomeCronk",
"contributes": {
"languages": [{
"id": "lgc",
"aliases": ["lgc", "Lgc", "LGC"],
"extensions": [".lgc",".ttb"]
}],
"grammars": [{
"language": "lgc",
"scopeName": "source.lgc",
"path": "./syntaxes/lgc.tmLanguage.json"
}]
}
}
syntaxes/lgc.tmLanguage.json:
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "Lgc",
"patterns": [
{
"include": "#keywords"
}
],
"repository":
{
"keywords":
{
"paterns":
[
{
"name:": "keyword.gate.lgc",
"match": "a"
}
]
}
},
"scopeName": "source.lgc"
}
This is a test that should highlight any instance of the letter a as keywords. When I copy this folder to $Home/.vscode/extensions/, and restart VSCode with a .lgc file open, it is not highlighted at all. All the text is white. The status bar shows lgc as the language, so I know VSCode is detecting the language properly. Why doesn't it highlight?
I think you have a typo in your syntaxes/lgc.tmLanguage.json file:
"paterns":
Should be:
"patterns":

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

Unable to create menu with contributes.menu

I am unable to create a menu using the documentation at the link below for contributes.menu. Actually, I was able to create one menu item, but could not create a second one. The code excerpt is from my package.json on Windows 10 using VS Code 1.37.0.
So my question is, can someone show me an example of adding two menu items?
-TIA
"contributes": {
"menus": {
"editor/title": [{
"title": "Underline Text",
"when": "editorHasSelection",
"command": "macros.underline",
"alt": "markdown.showPreviewToSide",
"group": "MyGroup#1"
}]
},
"languages": [
https://code.visualstudio.com/api/references/contribution-points#contributes.menus
Already tried the above code.
Here is an example package.json, based on the one in the tutorial, that creates two menu items:
{
...
"activationEvents": [
"onCommand:extension.helloWorld",
"onCommand:extension.helloAnotherWorld"
],
"contributes": {
"commands": [
{
"command": "extension.helloWorld",
"title": "Hello World"
},
{
"command": "extension.helloAnotherWorld",
"title": "Hello Another World"
}
],
"menus": {
"editor/title/context": [
{
"command": "extension.helloWorld"
},
{
"command": "extension.helloAnotherWorld"
}
]
}
},
...
}