Curly brackets VS Code on mac Osx - visual-studio

Just moved to Mac OSX and I can't type curly brackets with the old ALT-123 for open brace and so on.
Any fast solution?
Thanks!

I didn't figure out but I create some snippets into the keybindings.json
// Empty
[
// INSERT CURLY BRACKETS
{
"key": "alt+numpad2",
"command": "extension.embraceCurlyBrackets",
"when": "editorHasSelection && editorTextFocus"
},
{
"key": "alt+shift+numpad2",
"command": "editor.action.insertSnippet",
"args": {
"snippet": "{\n\t$1\n}",
},
"when": "editorTextFocus"
},
{
"key": "alt+numpad1",
"command": "editor.action.insertSnippet",
"args": {
"snippet": "{$1"
},
"when": "editorTextFocus"
},
{
"key": "alt+numpad3",
"command": "editor.action.insertSnippet",
"args": {
"snippet": "}$1"
},
"when": "editorTextFocus"
},
// INSERT CONSOLE LOG
{
"key": "ctrl+shift+l",
"command": "editor.action.insertSnippet",
"args": {
"snippet": "console.log($1)"
},
"when": "editorTextFocus"
},
]
A few shortcuts to speed up the work!

Related

.Net 6 Windows Forms with Blazor, Debug in VSCode Not working

I let vscode create launch.json and tasks.json for me in a .net6 windows forms with WebView (Microsoft.AspNetCore.Components.WebView.WindowsForms) I changed it a little and they are:
launch.json:
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
//"request": "launch",
"preLaunchTask": "watch",
"program": "${workspaceFolder}/bin/Debug/net6.0-windows/WinFormsBlazor.dll",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
// "serverReadyAction": {
// "action": "openExternally",
// "pattern": "\\bNow listening on:\\s+(https?://\\S+)"
// },
"env": {
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_URLS": "http://localhost:5000"
},
"sourceFileMap": {
//"/Pages": "${workspaceFolder}"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processName": "WinFormsBlazor.exe"
}
]
and tasks.json:
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/WinFormsBlazor.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/WinFormsBlazor.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/WinFormsBlazor.csproj"
],
"problemMatcher": "$msCompile"
}
]
The project is then run for view but debug does not work, Why debug is not working? (debug in .razor files)

Debug Blazor Server in VSCode

launch.json:
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (web)",
"type": "msedge",
"request": "launch",
"preLaunchTask": "build",
"cwd": "${workspaceFolder}",
"webRoot": "${workspaceFolder}",
// "serverReadyAction": {
// "action": "openExternally",
// "pattern": "\\bNow listening on:\\s+(https?://\\S+)"
// },
"env": {
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_URLS": "http://localhost:5000"
},
"sourceMaps": true,
//"url": "http://localhost:5000",
// If you have changed the default port / launch URL make sure to update the expectation below
//"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}"
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
and tasks.json:
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "process",
"command": "dotnet",
//"group": "build",
"args": [
"watch",
"run",
"${workspaceFolder}/BlazorStore9.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
// "presentation": {
// // Reveal the output only if unrecognized errors occur.
// "reveal": "silent"
// },
// Use the standard MS compiler pattern to detect errors, warnings and infos
"problemMatcher": "$msCompile",
"options": {"cwd": "${workspaceFolder}"}
}
]
This only launches site for browsing but not debug, How to correct these files for debug?
I removed "request": "launch", from launch.json and debug works.

How can I add an new debuggable backend to existing teams app using teams toolkit in VSCode?

I generated a new teams app that has a front end and bot features.
Now I would add a backend to manage server logic.
I would not do that in the bot app.
So I used teams toolkit to add new feature:
Logically I have choosen azure functions, because I would be able to deploy all my app components using the toolkit tools.
Now in my project directory I have the the sub-app:
My questions are :
How can I include this backend app to the launch.json and
tasks.json in order to make it debuggable as the bot and the front
end ?
//launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Remote (Edge)",
"type": "pwa-msedge",
"request": "launch",
"url": "https://teams.microsoft.com/l/app/${teamsAppId}?installAppPackage=true&webjoin=true&${account-hint}",
"presentation": {
"group": "remote",
"order": 2
}
},
{
"name": "Launch Remote (Chrome)",
"type": "pwa-chrome",
"request": "launch",
"url": "https://teams.microsoft.com/l/app/${teamsAppId}?installAppPackage=true&webjoin=true&${account-hint}",
"presentation": {
"group": "remote",
"order": 1
}
},
{
"name": "Attach to Frontend (Edge)",
"type": "pwa-msedge",
"request": "launch",
"url": "https://teams.microsoft.com/l/app/${localTeamsAppId}?installAppPackage=true&webjoin=true&${account-hint}",
"cascadeTerminateToConfigurations": [
"Attach to Backend",
"Attach to Bot"
],
"presentation": {
"group": "all",
"hidden": true
}
},
{
"name": "Attach to Frontend (Chrome)",
"type": "pwa-chrome",
"request": "launch",
"url": "https://teams.microsoft.com/l/app/${localTeamsAppId}?installAppPackage=true&webjoin=true&${account-hint}",
"cascadeTerminateToConfigurations": [
"Attach to Backend",
"Attach to Bot"
],
"presentation": {
"group": "all",
"hidden": true
}
},
{
"name": "Attach to Bot",
"type": "pwa-node",
"request": "attach",
"port": 9239,
"restart": true,
"presentation": {
"group": "all",
"hidden": true
}
},
],
"compounds": [
{
"name": "Debug (Edge)",
"configurations": [
"Attach to Frontend (Edge)",
"Attach to Bot",
],
"preLaunchTask": "Pre Debug Check & Start All",
"presentation": {
"group": "all",
"order": 2
},
"stopAll": true
},
{
"name": "Debug (Chrome)",
"configurations": [
"Attach to Frontend (Chrome)",
"Attach to Bot",
],
"preLaunchTask": "Pre Debug Check & Start All",
"presentation": {
"group": "all",
"order": 1
},
"stopAll": true
}
]
}
How to make it deployable also directly from the toolkit deployment
tools
When Azure Functions is added to the project, .vscode/launch.json and .vscode/tasks.json should be updated automatically to support debug Azure Functions. Your case is strange. Anyway, you can use following .vscode/launch.json and .vscode/tasks.json to debug your app.
// .vscode/launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Remote (Edge)",
"type": "pwa-msedge",
"request": "launch",
"url": "https://teams.microsoft.com/l/app/${teamsAppId}?installAppPackage=true&webjoin=true&${account-hint}",
"presentation": {
"group": "remote",
"order": 1
}
},
{
"name": "Launch Remote (Chrome)",
"type": "pwa-chrome",
"request": "launch",
"url": "https://teams.microsoft.com/l/app/${teamsAppId}?installAppPackage=true&webjoin=true&${account-hint}",
"presentation": {
"group": "remote",
"order": 2
}
},
{
"name": "Attach to Frontend (Edge)",
"type": "pwa-msedge",
"request": "launch",
"url": "https://teams.microsoft.com/l/app/${localTeamsAppId}?installAppPackage=true&webjoin=true&${account-hint}",
"cascadeTerminateToConfigurations": [
"Attach to Backend",
"Attach to Bot"
],
"presentation": {
"group": "all",
"hidden": true
}
},
{
"name": "Attach to Frontend (Chrome)",
"type": "pwa-chrome",
"request": "launch",
"url": "https://teams.microsoft.com/l/app/${localTeamsAppId}?installAppPackage=true&webjoin=true&${account-hint}",
"cascadeTerminateToConfigurations": [
"Attach to Backend",
"Attach to Bot"
],
"presentation": {
"group": "all",
"hidden": true
}
},
{
"name": "Attach to Bot",
"type": "pwa-node",
"request": "attach",
"port": 9239,
"restart": true,
"presentation": {
"group": "all",
"hidden": true
}
},
{
"name": "Attach to Backend",
"type": "pwa-node",
"request": "attach",
"port": 9229,
"restart": true,
"presentation": {
"group": "all",
"hidden": true
},
"internalConsoleOptions": "neverOpen"
}
],
"compounds": [
{
"name": "Debug (Edge)",
"configurations": [
"Attach to Frontend (Edge)",
"Attach to Bot",
"Attach to Backend"
],
"preLaunchTask": "Pre Debug Check & Start All",
"presentation": {
"group": "all",
"order": 1
},
"stopAll": true
},
{
"name": "Debug (Chrome)",
"configurations": [
"Attach to Frontend (Chrome)",
"Attach to Bot",
"Attach to Backend"
],
"preLaunchTask": "Pre Debug Check & Start All",
"presentation": {
"group": "all",
"order": 2
},
"stopAll": true
}
]
}
// .vscode/tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "Pre Debug Check & Start All",
"dependsOn": [
"validate local prerequisites",
"start ngrok",
"prepare local environment",
"Start All"
],
"dependsOrder": "sequence"
},
{
"label": "validate local prerequisites",
"type": "shell",
"command": "exit ${command:fx-extension.validate-local-prerequisites}",
"presentation": {
"reveal": "never"
}
},
{
"label": "start ngrok",
"dependsOn": "teamsfx: ngrok start"
},
{
"label": "prepare local environment",
"type": "shell",
"command": "exit ${command:fx-extension.pre-debug-check}",
"presentation": {
"reveal": "never"
}
},
{
"label": "Start All",
"dependsOn": [
"Start Frontend",
"Start Backend",
"Start Bot"
]
},
{
"label": "Start Frontend",
"type": "shell",
"command": "npm run dev:teamsfx",
"isBackground": true,
"problemMatcher": "$teamsfx-frontend-watch",
"options": {
"cwd": "${workspaceFolder}/tabs"
}
},
{
"label": "Start Backend",
"type": "shell",
"command": "npm run dev:teamsfx",
"isBackground": true,
"problemMatcher": "$teamsfx-backend-watch",
"options": {
"cwd": "${workspaceFolder}/api",
"env": {
"PATH": "${command:fx-extension.get-func-path}${env:PATH}"
}
},
"presentation": {
"reveal": "silent"
}
},
{
"label": "Start Bot",
"type": "shell",
"command": "npm run dev:teamsfx",
"isBackground": true,
"problemMatcher": {
"pattern": [
{
"regexp": "^.*$",
"file": 0,
"location": 1,
"message": 2
}
],
"background": {
"activeOnStart": true,
"beginsPattern": "[nodemon] starting",
"endsPattern": "restify listening to|Bot/ME service listening at|[nodemon] app crashed"
}
},
"options": {
"cwd": "${workspaceFolder}/bot"
},
"presentation": {
"reveal": "silent"
}
}
]
}
For deployment, run "Provision in the cloud" first, and then run "Deploy to the cloud" command.

How to add section of json to the existing file using jq

I am using jq to parse a JSON file. I have some section of JSON file with below content
[
{
"PropagateAtLaunch": true,
"Value": {
"Ref": "TNAM"
},
"Key": "Name"
},
{
"PropagateAtLaunch": true,
"Value": {
"Ref": "TAPP"
},
"Key": "application"
},
{
"PropagateAtLaunch": true,
"Value": {
"Ref": "TENV"
},
"Key": "environment"
},
{
"PropagateAtLaunch": true,
"Value": {
"Ref": "TSHA"
},
"Key": "shared"
},
{
"PropagateAtLaunch": true,
"Value": {
"Ref": "TTER"
},
"Key": "tier"
},
{
"PropagateAtLaunch": true,
"Value": {
"Ref": "CostCenter"
},
"Key": "cost-center"
}
]
In this I want to add another section like:
{
"Value": {
"Ref": "TEAM"
},
"PropagateAtLaunch": true,
"Key": "TEAM"
}
How can I add this new section?
This is the query I have used to extract the first section:
$ cat ABC.json | jq '.Resources.ASGRP.Properties.Tags'
You can pass the object as a jq variable using --argjson, then use += to add the object to the array:
jq --argjson obj '{"sample": "object"}' '.Resources.ASGRP.Properties.Tags += [$obj]'
If you don't want the original object, use + instead of +=.
Try this "jq -s add ABC.json add.json" as below;
user#host:/tmp$ cat add.json
[
{
"Value": {
"Ref": "TEAM"
},
"PropagateAtLaunch": true,
"Key": "TEAM"
}
]
user#host:/tmp$ jq -s add ABC.json add.json > ABCLAST.json
user#host:/tmp$ cat ABCLAST.json
[
{
"PropagateAtLaunch": true,
"Value": {
"Ref": "TNAM"
},
"Key": "Name"
},
{
"PropagateAtLaunch": true,
"Value": {
"Ref": "TAPP"
},
"Key": "application"
},
{
"PropagateAtLaunch": true,
"Value": {
"Ref": "TENV"
},
"Key": "environment"
},
{
"PropagateAtLaunch": true,
"Value": {
"Ref": "TSHA"
},
"Key": "shared"
},
{
"PropagateAtLaunch": true,
"Value": {
"Ref": "TTER"
},
"Key": "tier"
},
{
"PropagateAtLaunch": true,
"Value": {
"Ref": "CostCenter"
},
"Key": "cost-center"
},
{
"PropagateAtLaunch": true,
"Value": {
"Ref": "TEAM"
},
"Key": "TEAM"
}
]

Sublime Text 2 double quote font-style depends on file extension?

The auto-pairing of double quotes is a really strange issue that I thought I'd solved but still persists. The issue is that for files of the extension .php, .html, the default font-style of auto-paired double quotes is not parseable. To show you what I mean, notice the font-style of the double quotes in the <div> on the left. Whereas with .js and .css files, the double quote auto-pairing has the proper font-style as shown in the <div> on the right>.
This must be a setting somewhere but I don't know Sublime Text2 (Mac OSX) so well. Thoughts?
With the huge help from #JamieJag I've isolated the problem. Shift+" was producing what Sublime calls "typographical" quotes and not the double quotes which are parseable as part of PHP or HTML code.
To fix the problem, I commented out everything in my SublimeText2 preferences->key bindings->user.
It's unclear to me whether one or all of these JSON object is responsible for the problematic behavior (though I'd guess the first JSON looks like the offender) but so far just commenting out the entire array solved my problem.
/*[
// Auto-pair typographical quotes
{ "keys": ["\""], "command": "insert_snippet", "args": {"contents": "“$0”"}, "context":
[
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|”|;|\\}|$)", "match_all": true },
{ "key": "selector", "operator": "equal", "operand": "text", "match_all": true }
]
},
{ "keys": ["\""], "command": "insert_snippet", "args": {"contents": "“${0:$SELECTION}”"}, "context":
[
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true },
{ "key": "selector", "operator": "equal", "operand": "text", "match_all": true }
]
},
{ "keys": ["\""], "command": "move", "args": {"by": "characters", "forward": true}, "context":
[
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^\\”", "match_all": true },
{ "key": "selector", "operator": "equal", "operand": "text", "match_all": true }
]
},
// Smart quotes before & after word
{ "keys": ["\""], "command": "insert_snippet", "args": {"contents": "“$0"}, "context":
[
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^\\S", "match_all": true },
{ "key": "selector", "operator": "equal", "operand": "text", "match_all": true }
]
},
{ "keys": ["\""], "command": "insert_snippet", "args": {"contents": "”$0"}, "context":
[
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\S", "match_all": true },
{ "key": "selector", "operator": "equal", "operand": "text", "match_all": true }
]
}
]*/

Resources