I'm trying to set up a Sublime Text Repl for Postgres using Sublime Repl.
I've set up a new folder in Users/Packages/SublimeRepl/config called Postgres and added two files:
Main.sublime-menu has the following content
[
{
"id": "tools",
"children":
[{
"caption": "SublimeREPL",
"mnemonic": "R",
"id": "SublimeREPL",
"children":
[
{"command": "repl_open",
"caption": "PSQL",
"id": "repl_psql",
"mnemonic": "Q",
"args": {
"type": "subprocess",
"encoding": {"windows": "$win_cmd_encoding",
"linux": "utf-8",
"osx": "utf-8"},
"cmd": {"windows": ["psql.exe", "-a"],
"linux": ["psql","-U","tahnoon"],
"osx": ["psql","-U","tahnoon"]},
"cwd": "$file_path",
"cmd_postfix": "\n",
"env": {},
"suppress_echo": false,
"syntax": "Packages/SQL/SQL.tmLanguage"
}
}
]
}]
}
]
and Default.sublime-commands has the following content
[
{
"caption": "SublimeREPL: PSQL",
"command": "run_existing_window_command", "args":
{
"id": "repl_psql",
"file": "config/Postgres/Main.sublime-menu"
}
}
]
If I launch a repl and try and Eval from a file called test.sql with Ctrl+,F I get an error message Cannot Find Repl for 'sql'.
What am I doing wrong?
Discovered that the following key-value "external_id":"sql" does the trick:
[
{
"id": "tools",
"children":
[{
"caption": "SublimeREPL",
"mnemonic": "R",
"id": "SublimeREPL",
"children":
[
{"command": "repl_open",
"caption": "PSQL",
"id": "repl_sql",
"mnemonic": "Q",
"args": {
"type": "subprocess",
"encoding": {"windows": "$win_cmd_encoding",
"linux": "utf-8",
"osx": "utf-8"},
"cmd": {"windows": ["psql.exe","-U","tahnoon"],
"linux": ["psql","-U","tahnoon"],
"osx": ["psql","-U","tahnoon"]},
"cwd": "$file_path",
"cmd_postfix": "\n",
"cwd": "$file_path",
"external_id": "sql",
"suppress_echo": false,
"syntax": "Packages/SQL/SQL.tmLanguage"
}
}
]
}]
}
]
Related
I can use input variables from launch.json in launch.json.
"configurations": [
{
...
"args": [${input:file_no}]
"preLanuchTask": "runPreTasks"
...
}
],
"inputs": [
{
"id": "file_no",
"type": "promptString"
}
]
Now, I want to get access to the same variable without entering input a second time in tasks.json.
{
"version": "2.0.0",
"tasks":[
{
"label": "runPreTasks",
"type": "shell",
"command": sh,
"args": [
"/path2script/scriptName.sh",
"${input:file_no}" // This does not work, without defining input again
]
}
]
}
Is there a way to pass input variables from launch.json to tasks.json in vscode?
You can use the extension Command Variable v1.21.0
It has a command extension.commandvariable.promptStringRemember that behaves the same as an ${input:name} promptString variable. By adding a key property the result is saved under this key and you can retreive it with the extension.commandvariable.rememberPick command.
The extension.commandvariable.rememberPick command can be used in a different task/launch than the extension.commandvariable.promptStringRemember command
{
"version": "2.0.0",
"tasks": [
{
"label": "Task 1",
"type": "shell",
"command": "dostuff1",
"args": ["-p", "${input:promptPath}"]
},
{
"label": "Task 2",
"type": "shell",
"command": "dostuff2",
"args": ["-p", "${input:rememberPath}"]
},
{
"label": "Do Task 1 and 2",
"dependsOrder": "sequence",
"dependsOn": ["Task 1", "Task 2"],
"problemMatcher": []
}
],
"inputs": [
{
"id": "promptPath",
"type": "command",
"command": "extension.commandvariable.promptStringRemember",
"args": {
"key": "path",
"description": "Enter a path"
}
},
{
"id": "rememberPath",
"type": "command",
"command": "extension.commandvariable.rememberPick",
"args": { "key": "path" }
}
]
}
Following #rioV8 answer, I edited my json files as shown below:
launch.json:
"configurations": [
{
...
"args": [${input:file_no}]
"preLanuchTask": "runPreTasks"
...
}
],
"inputs": [
{
"id": "file_no",
"type": "command",
"command": "extension.commandvariable.promptStringRemember",
"args": {
"key": "lastnumber",
"description": "Enter the number"
}
}
]
tasks.json:
{
"version": "2.0.0",
"tasks":[
{
"label": "runPreTasks",
"type": "shell",
"command": sh,
"args": [
"/path2script/scriptName.sh",
"${input:file_no}"
]
}
]
"inputs": [
{
"id": "file_no",
"type": "command",
"command": "extension.commandvariable.rememberPick",
"args": { "key": "lastnumber" }
}
]
}
Is there a way to add a folder into a workspace by tasks?
Is it possible to add and remove (or hide) folders in a workspace on selecting options from input in tasks.json?
{
"version": "2.0.0",
"inputs": [
{
"id": "selectProject",
"type": "pickString",
"description": "Some decription",
"options":
[
"PROJECT1",
"PROJECT2"
]
}
],
"tasks": [
{
"label": "add into workspace",
"type": "process",
"command": "command-to-add-folder-into-workspace", // what do I need to put here?
"args": [
"${input:selectProject}"
]
}
]
}
I've found a solution using code --add folder in tasks.
File .code-workspace
{
"folders": [
{
"name": "wp",
"path": "../wp" // folder has .code-workspace file
}
],
"settings": { /*...*/ },
"tasks": {
"inputs":[
{
"id": "selectProject",
"type": "pickString",
"description": "select project",
"options":
[
"PROJECT1",
"PROJECT2"
]
}
],
"version": "2.0.0",
"tasks": [
{
"label": "Add project",
"type": "shell",
"command": "code", // usind command code --add folder
"options": {
"cwd": "${workspaceFolder}"
},
"args": [
"--add",
"../${input:selectTest}"
],
"presentation": {
"echo": false,
"reveal": "always",
"clear": false,
"showReuseMessage": false
}
}
]
}
}
What are the best solutions to receive input from user in inputs vscode on tasks.json then according chosen option to handle multiple values?
Is there any solution like this bellow?
{
"version": "2.0.0",
"inputs": [
{
"id": "selectProject",
"type": "pickString",
"description": "Some decription",
"options":
[
{
"label": "project1",
"value" : {"path":"","name":"","link":"","anyOther":""} // something like this
} ,
{
"label": "project2",
"value" : {"path":"","name":"","link":"","anyOther":""} // something like this
}
]
}
],
"tasks": [
{
"label": "test on projects",
"type": "process",
"command": "echo",
"args": [
"${input:selectProject.path}", // handle many info from one chosen option
"${input:selectProject.name}",
"${input:selectProject.link}",
"${input:selectProject.anyOther}"
]
}
]
}
currently options can receive only one value :(
"options":
[
{ "label": "project1", "value" : "value" } ,
{ "label": "project2", "value" : "value" }
]
You can use extension Command Variable v1.22.0.
The command extension.commandvariable.pickStringRemember can remember multiple values for 1 pick.
The syntax of the label-value is a bit different because I did not know pickString supported that.
{
"version": "2.0.0",
"tasks": [
{
"label": "Do some project",
"type": "process",
"command": "echo",
"args": [
"${input:selectProject.path}",
"${input:selectProject.name}",
"${input:selectProject.link}",
"${input:selectProject.anyOther}"
],
"problemMatcher": []
}
],
"inputs": [
{
"id": "selectProject.path",
"type": "command",
"command": "extension.commandvariable.pickStringRemember",
"args": {
"key": "path",
"options": [
["project1", {"path":"p1","name":"n1","link":"lnk1","anyOther":"any1"}],
["project2", {"path":"p2","name":"n2","link":"lnk2","anyOther":"any2"}]
],
"description": "Pick a project"
}
},
{
"id": "selectProject.name",
"type": "command",
"command": "extension.commandvariable.rememberPick",
"args": { "key": "name" }
},
{
"id": "selectProject.link",
"type": "command",
"command": "extension.commandvariable.rememberPick",
"args": { "key": "link" }
},
{
"id": "selectProject.anyOther",
"type": "command",
"command": "extension.commandvariable.rememberPick",
"args": { "key": "anyOther" }
}
]
}
In my lumen 8.0 app I want to add Resets Passwords functionality reading
Trying to reset Passwords in Lumen
article but I got error :
{
"message": "Target [Illuminate\\Contracts\\Mail\\Factory] is not instantiable while building [Illuminate\\Notifications\\Channels\\MailChannel].",
"exception": "Illuminate\\Contracts\\Container\\BindingResolutionException",
"file": "/mnt/_work_sdb8/wwwroot/LumenProjects/PublishPagesAPI/vendor/illuminate/container/Container.php",
"line": 1089,
"trace": [
{
"file": "/mnt/_work_sdb8/wwwroot/LumenProjects/PublishPagesAPI/vendor/illuminate/container/Container.php",
"line": 882,
"function": "notInstantiable",
"class": "Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "/mnt/_work_sdb8/wwwroot/LumenProjects/PublishPagesAPI/vendor/illuminate/container/Container.php",
"line": 754,
"function": "build",
"class": "Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "/mnt/_work_sdb8/wwwroot/LumenProjects/PublishPagesAPI/vendor/illuminate/container/Container.php",
"line": 692,
"function": "resolve",
"class": "Illuminate\\Container\\Container",
"type": "->"
},
In my composer.json :
{
"name": "laravel/lumen",
"description": "The Laravel Lumen Framework.",
"keywords": ["framework", "laravel", "lumen"],
"license": "MIT",
"type": "project",
"require": {
"php": "^7.3|^8.0",
"anik/form-request": "^4.2",
"cviebrock/eloquent-sluggable": "^8.0",
"dusterio/lumen-passport": "^0.3.4",
"flipbox/lumen-generator": "^8.2",
"guzzlehttp/guzzle": "^7.3",
"illuminate/mail": "^8.48",
"illuminate/notifications": "^8.49",
"intervention/image": "^2.5",
"laravel/lumen-framework": "^8.0",
"league/flysystem": " ~1.0"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"mockery/mockery": "^1.3.1",
"phpunit/phpunit": "^9.3"
},
"autoload": {
"files": [
"app/library/helper.php"
],
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"classmap": [
"tests/"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
]
}
}
Do I need to install some packages and how to init it in my package ?
Reading branch https://github.com/laravel/lumen-framework/issues/1057 I found decision with adding lines :
$app->alias('mail.manager', Illuminate\Mail\MailManager::class);
$app->alias('mail.manager', Illuminate\Contracts\Mail\Factory::class);
in file bootstrap/app.php. And it works!
When I try to set a breakpoint nothing happens; I put my cursor on the println! line and press F9.
fn main() {
println!("Hello, world!");
}
I works on another machine where Visual Studio 2017 is installed, so I suspect this might the problem.
tasks.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "cargo build",
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"panel": "dedicated",
"clear": true
},
"problemMatcher": {
"owner": "rust",
"fileLocation": [
"relative",
"${workspaceRoot}"
],
"pattern": {
"regexp": "^(.+):(\\d+):(\\d+):\\s+(\\d+):(\\d+)\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"endLine": 4,
"endColumn": 5,
"severity": 6,
"message": 7
}
}
},
{
"label": "clean",
"type": "shell",
"command": "cargo clean"
},
{
"label": "run",
"type": "shell",
"command": "cargo run",
"presentation": {
"panel": "dedicated",
"clear": true
},
"problemMatcher": []
},
{
"label": "test",
"type": "shell",
"command": "cargo test",
"group": {
"kind": "test",
"isDefault": true
},
"presentation": {
"panel": "dedicated",
"clear": true
},
"problemMatcher": [
{
"owner": "rust",
"fileLocation": [
"relative",
"${workspaceRoot}"
],
"pattern": {
"regexp": "^(.+):(\\d+):(\\d+):\\s+(\\d+):(\\d+)\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"endLine": 4,
"endColumn": 5,
"severity": 6,
"message": 7
}
},
{
"owner": "rust",
"fileLocation": [
"relative",
"${workspaceRoot}"
],
"severity": "error",
"pattern": {
"regexp": "^.*panicked\\s+at\\s+'(.*)',\\s+(.*):(\\d+)$",
"message": 1,
"file": 2,
"line": 3
}
}
]
}
]
}
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "(Windows) Launch",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/target/debug/${workspaceRootFolderName}",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}/target/debug/",
"environment": [],
"externalConsole": true,
},
]
}
I have Visual Studio 2019 installed:
>cl --version
Microsoft (R) C/C++ Optimizing Compiler Version 19.20.27508.1 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
I have these Visual Studio Code extensions installed:
C/C++ 0.22.1
Rust (rls) 0.6.0
I am using Rust 1.33.0.
try setting the setting value "debug.allowBreakpointsEverywhere" to true