powershell - 编辑器面板中的visual-studio-code Powershell命令自动完成不起作用
问题描述
我刚刚开始使用 Visual Studio Code 来处理 Powershell。我已经加载了 powershell 扩展,当我连接到 Exchange 时,cmdlet 的自动完成功能在集成的 powershell 窗口中工作,但它在 to peditor 面板中不起作用。如何让 cmdlet 自动完成或智能感知在编辑器面板中工作?谢谢!
解决方案
您不会说您是否将 VSCode 环境配置为使 PowerShell 成为默认语言。如果您查看编辑器的右上角,它将告诉您当前设置的语言。显示您的用户设置。在您的用户设置中,您应该有这样的行(只是我的一个示例,根据您的用例需要进行调整 - 有关 VSCode 用户设置的详细信息,请参阅文档。)...</p>
"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+空格键智能感知踢它,或键入重新加载。
再一次,这一直发生在我身上,上面的事情又回来了。这很烦人,但就是这样。
推荐阅读
- jquery - jQuery替换元素中的字符串会破坏内容
- assembly - MIPS跳转指令编码:为什么要左移,为什么要保留PC的高4位?
- android-studio - 在 Android Studio 的 ViewPager 中打开一个新片段
- javascript - 将数据库记录建模为 javascript 类对象的最佳实践是什么?
- c# - Assembly.LoadFile 在同一个程序集上引发程序集解析事件
- flutter - 未处理的异常:DioError [DioErrorType.DEFAULT]:将对象转换为可编码对象失败
- azure - 是否有内置方法可以将集合复制到同一区域中的“追随者”集合?
- javascript - 为什么 JavaScript 的 bind() 不能像我预期的那样在这里工作?
- linux - AWS EC2 上的粘性弹性 IP
- excel - Excel 的 SELECT 或 WORKSHEET 有问题。不知道为什么