Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio code 从游标位置执行SQL语句,而无需在PowerShell中选择类似F8的选项_Visual Studio Code - Fatal编程技术网

Visual studio code 从游标位置执行SQL语句,而无需在PowerShell中选择类似F8的选项

Visual studio code 从游标位置执行SQL语句,而无需在PowerShell中选择类似F8的选项,visual-studio-code,Visual Studio Code,我正在使用带有ms sql扩展名的VSCode 我希望执行sql语句而不选择它。所以我有乙二醇 Select that from this go select more fro|m there where valid = 1 go 光标位于位置“|”,如果我按了一个特定的键(如PowerShell中的F8),它将执行第二条SQL语句。光标位置可以在代码中的任何位置。 无论如何,这行得通吗 因为我被否决了,我想,也许这比想象的要容易。是的,有一个现成的命令。只需将以下内容添加到key

我正在使用带有ms sql扩展名的VSCode

我希望执行sql语句而不选择它。所以我有乙二醇

Select that from 
this

go
select more 

fro|m there

where valid = 1

go
光标位于位置“|”,如果我按了一个特定的键(如PowerShell中的F8),它将执行第二条SQL语句。光标位置可以在代码中的任何位置。
无论如何,这行得通吗

因为我被否决了,我想,也许这比想象的要容易。是的,有一个现成的命令。只需将以下内容添加到keybindings.json中即可工作:

{
"key": "f8",
"command": "mssql.runCurrentStatement",
"when": "editorTextFocus && editorLangId == 'sql'"
}