visual-studio-code Powershell 命令在编辑器面板中自动完成不起作用
visual-studio-code Powershell command auto-complete in the editor panel not working
我刚刚开始使用 Visual Studio 代码来处理 Powershell。我已经加载了 powershell 扩展,当我连接到 Exchange 时,cmdlet 的自动完成在集成的 powershell window 中工作,但它在 to peditor 面板中不起作用。如何让 cmdlet 自动完成或智能感知在编辑器面板中工作?谢谢!
您没有说您是否配置了 VSCode 环境以将 PowerShell 设置为默认语言。如果您查看编辑器的右上角,它会告诉您当前设置的语言。显示您的用户设置。在您的用户设置中,您应该有这样的行(只是我的示例,根据您的用例需要进行调整 - 有关 VSCode 用户设置的详细信息,请参阅文档。)...
"extensions.autoUpdate": true,
"files.defaultLanguage": "powershell",
"powershell.scriptAnalysis.enable": true,
"powershell.startAutomatically": true,
"powershell.integratedConsole.focusConsoleOnExecute": false,
"powershell.enableProfileLoading": true,
"powershell.developer.editorServicesLogLevel": "Verbose",
"editor.formatOnSave": true,
"editor.minimap.enabled": false,
"editor.mouseWheelZoom": true,
"editor.tabCompletion": "on",
"editor.suggestSelection": "first",
"terminal.integrated.shell.windows": "C:\WINDOWS\Sysnative\WindowsPowerShell\v1.0\powershell.exe",
"terminal.integrated.rightClickBehavior": "default",
"window.title": "${activeEditorLong}",
"powershell.powerShellExePath": "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe",
"powershell.scriptAnalysis.settingsPath": "ScriptAnalyzerSettings.psd1",
"workbench.startupEditor": "newUntitledFile",
"editor.cursorStyle": "line-thin",
"shellLauncher.shells.windows": [
{
"shell": "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe",
"label": "PowerShell 5.1"
},
{
"shell": "C:\Program Files\PowerShell\6\pwsh.exe",
"label": "PowerShell 6.0"
},
{
"shell": "C:\Windows\System32\cmd.exe",
"label": "cmd"
},
{
"shell": "C:\Program Files\Git\bin\bash.exe",
"label": "Git bash"
},
{
"shell": "C:\Windows\System32\bash.exe",
"label": "WSL Bash"
},
VSCode 因智能感知无缘无故停止而臭名昭著(这是我的第一要务),但在大多数情况下,您所要做的就是退格到命令的开头,然后重试,或使用 CRTL+空格键让智能感知踢它,或键入重新加载。
同样,这种情况一直发生在我身上,上面的事情又回来了。这很烦人,但事实就是如此。
我刚刚开始使用 Visual Studio 代码来处理 Powershell。我已经加载了 powershell 扩展,当我连接到 Exchange 时,cmdlet 的自动完成在集成的 powershell window 中工作,但它在 to peditor 面板中不起作用。如何让 cmdlet 自动完成或智能感知在编辑器面板中工作?谢谢!
您没有说您是否配置了 VSCode 环境以将 PowerShell 设置为默认语言。如果您查看编辑器的右上角,它会告诉您当前设置的语言。显示您的用户设置。在您的用户设置中,您应该有这样的行(只是我的示例,根据您的用例需要进行调整 - 有关 VSCode 用户设置的详细信息,请参阅文档。)...
"extensions.autoUpdate": true,
"files.defaultLanguage": "powershell",
"powershell.scriptAnalysis.enable": true,
"powershell.startAutomatically": true,
"powershell.integratedConsole.focusConsoleOnExecute": false,
"powershell.enableProfileLoading": true,
"powershell.developer.editorServicesLogLevel": "Verbose",
"editor.formatOnSave": true,
"editor.minimap.enabled": false,
"editor.mouseWheelZoom": true,
"editor.tabCompletion": "on",
"editor.suggestSelection": "first",
"terminal.integrated.shell.windows": "C:\WINDOWS\Sysnative\WindowsPowerShell\v1.0\powershell.exe",
"terminal.integrated.rightClickBehavior": "default",
"window.title": "${activeEditorLong}",
"powershell.powerShellExePath": "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe",
"powershell.scriptAnalysis.settingsPath": "ScriptAnalyzerSettings.psd1",
"workbench.startupEditor": "newUntitledFile",
"editor.cursorStyle": "line-thin",
"shellLauncher.shells.windows": [
{
"shell": "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe",
"label": "PowerShell 5.1"
},
{
"shell": "C:\Program Files\PowerShell\6\pwsh.exe",
"label": "PowerShell 6.0"
},
{
"shell": "C:\Windows\System32\cmd.exe",
"label": "cmd"
},
{
"shell": "C:\Program Files\Git\bin\bash.exe",
"label": "Git bash"
},
{
"shell": "C:\Windows\System32\bash.exe",
"label": "WSL Bash"
},
VSCode 因智能感知无缘无故停止而臭名昭著(这是我的第一要务),但在大多数情况下,您所要做的就是退格到命令的开头,然后重试,或使用 CRTL+空格键让智能感知踢它,或键入重新加载。
同样,这种情况一直发生在我身上,上面的事情又回来了。这很烦人,但事实就是如此。