简体   繁体   English

Intellisense 不会自动工作 VSCode

[英]Intellisense not automatically working VSCode

I just downloaded Visual Studio Code and my Intellisense is not automatically working.我刚刚下载了 Visual Studio Code,但我的 Intellisense 没有自动运行。

The two settings that control this seem to be set correctly:控制它的两个设置似乎设置正确:

"editor.quickSuggestions": true,
"editor.suggestOnTriggerCharacters": true,

I do get an Intellisense menu when i start typing and press "CTRL + Space", but this gives me a list of everything and not things specifically for my object.当我开始输入并按“CTRL + Space”时,我确实得到了一个 Intellisense 菜单,但这给了我一个所有的列表,而不是专门为我的 object 提供的列表。

What am i doing wrong?我究竟做错了什么?

Visual Studio Code's more advanced editing features (IntelliSense, refactoring tools, etc.) only work in C# files if you have a project.json file or *.sln file that VSCode is aware of. Visual Studio Code 的更高级的编辑功能(IntelliSense、重构工具等)仅适用于 C# 文件,前提是您有 VSCode 知道的project.json文件或*.sln文件。 Open the folder (ie open the File menu and click Open Folder... ) with the *.sln file or project.json and VSCode will attempt to find all project/solution files in the folder.打开带有*.sln文件或project.json的文件夹(即打开File菜单并单击Open Folder... ),VSCode 将尝试查找文件夹中的所有项目/解决方案文件。 If there are multiple projects, you may need to select one from the projects button on the right side of the status bar (bottom of the window).如果有多个项目,您可能需要从状态栏右侧(窗口底部)的项目按钮中选择一个。

From the VSCode website :VSCode 网站

  • Selecting a project.json -file is opening a DNX-project and VSCode will load that project plus the referenced projects选择一个project.json文件会打开一个 DNX 项目,VSCode 将加载该项目以及引用的项目
  • Selecting a *.sln -file is opening a MSBuild-project.选择*.sln文件将打开 MSBuild 项目。 It will load the referenced *.csproj -projects and sibling or descendant project.json -files but no other project files that are referenced from the solution file.它将加载引用的*.csproj -projects 和同级或后代project.json -files,但不会加载从解决方案文件中引用的其他项目文件。
  • Selecting a folder will make VSCode scan for *.sln and project.json files and VSCode will attempt to load them all.选择一个folder将使 VSCode 扫描*.slnproject.json文件,并且 VSCode 将尝试加载它们。

在此处输入图片说明

If you have a workspace and for some reason have multiple folders you may need to 'help' omnisharp a bit.如果您有一个工作区并且由于某种原因有多个文件夹,您可能需要“帮助” omnisharp 一点。 I initially had a big project and added a solution for it further on - ending up with TWO workspace folders (one to a startup project and one to the solution).我最初有一个大项目,并进一步为它添加了一个解决方案 - 最终有两个工作区文件夹(一个用于启动项目,一个用于解决方案)。 After composing that setup I experienced only the first project to have intellisense working.完成该设置后,我只经历了第一个让智能感知工作的项目。

Solution to get intellisense working was to make sure omnisharp worked its way from the solution instead of the project:让智能感知工作的解决方案是确保 omnisharp 从解决方案而不是项目中工作:

  1. Ctrl + Shift + p Ctrl + Shift + p
  2. Write "OmniSharp: Select Project" and press Enter.编写“OmniSharp:选择项目”并按 Enter。
  3. Choose the solution workspace entry.选择解决方案工作区条目。

Inspiration gotten from 'swaner': https://github.com/OmniSharp/omnisharp-vscode/issues/1889灵感来自“天鹅”: https : //github.com/OmniSharp/omnisharp-vscode/issues/1889

If you are start your project with c#, then some time you haven't download extension.如果您使用 c# 启动您的项目,那么有一段时间您还没有下载扩展。

Process by written书面处理

  • Ctrl + Shift + p. Ctrl + Shift + p。
  • Write "OmniSharp: Select Project" and press Enter.编写“OmniSharp:选择项目”并按 Enter。
  • Choose the solution workspace entry.选择解决方案工作区条目。
  • Then enable the c# extension for "OmniSharp : Project".然后为“OmniSharp : Project”启用 c# 扩展。

Process by image按图像处理

在此处输入图片说明

在此处输入图片说明

As of the 0.5 version I have found that I need to close and re-open my working files to get some new intellisense information to start working for my own files.从 0.5 版本开始,我发现我需要关闭并重新打开我的工作文件以获取一些新的智能感知信息,以便开始为我自己的文件工作。 This usually happens after I have a file open that needs to use type information from another file I just created.这通常发生在我打开一个需要使用我刚刚创建的另一个文件中的类型信息的文件之后。 Until I close and re-open them (within the editor) the intellisense doesn't always work.在我关闭并重新打开它们(在编辑器中)之前,智能感知并不总是有效。

Hopefully this is something that'll get fixed as the app matures.希望随着应用程序的成熟,这会得到解决。

Inorder to make the intelligence working, the Visual Studio Code extension OmniSharp should be there along with Mono.为了使智能工作,Visual Studio Code 扩展 OmniSharp 应该与 Mono 一起存在。 When you open a project/solution folder, the OmniSharp gets the project dependencies from either project.json or from the dotnet solution file (if the project/solution created with other versions of visual studio).当您打开项目/解决方案文件夹时,OmniSharp 从 project.json 或 dotnet 解决方案文件(如果项目/解决方案是使用其他版本的 Visual Studio 创建)获取项目依赖项。

So, when you look at the omnisharp's output window after immediately opening the project/ solution folder, you may see the following lines因此,当您立即打开项目/解决方案文件夹后查看 omnisharp 的输出窗口时,您可能会看到以下几行

Starting OmniSharp server at 2017-9-18 09:26:44
    Target: /Users/{username}/Source/{Your Solution Folder}/{Your Solution
file}.sln

OmniSharp server started wth Mono
    Path: /Users/{username}/.vscode/extensions/ms-vscode.csharp-1.12.1/.omnisharp/run
    PID: 5808

post that, you may see couple of lines coming up like below,发布后,您可能会看到如下所示的几行,

[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Update project: {Your Project1 Name}
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Update project: {Your Project2 Name} 
....

they mean that your projects are getting recognised by OmniSharp Extension.它们意味着您的项目得到了 OmniSharp Extension 的认可。

If you get any error message informing you about timeout, please get into the settings of the Visual Studio Code, and add a configuration override like the one below:如果您收到任何有关超时的错误消息,请进入 Visual Studio Code 的设置,并添加如下所示的配置覆盖:

  "omnisharp.projectLoadTimeout": 200

I know it is too long to wait for 200 seconds.我知道等待 200 秒太长了。 But don't worry, this won't stop you anymore working with project files.但别担心,这不会阻止您再使用项目文件。 But, remember that the IntelliSense will be automatically available once all the projects in the folder are successfully loaded.但是,请记住,一旦成功加载文件夹中的所有项目,IntelliSense 将自动可用。

Feel free to extend the Timeout setting since it will help you getting intellisense even-though you are not getting it immediately.随意扩展超时设置,因为它会帮助您获得智能感知,即使您没有立即获得它。

Here is another link with the same solution: https://github.com/OmniSharp/omnisharp-vscode/issues/1585这是具有相同解决方案的另一个链接: https : //github.com/OmniSharp/omnisharp-vscode/issues/1585

Hope my information helps you!希望我的信息对你有帮助! Enjoy your VSCode!享受你的 VSCode!

Another troubleshooting strategy to try if none of the above works out is uninstalling Mono , which is unnecessary anyways if you're using .NET Core.如果上述方法均无效,则要尝试的另一种故障排除策略是卸载 Mono ,如果您使用的是 .NET Core,则无论如何都不需要。 I also experienced a sudden disappearance of Intellisense after pulling changes to one of our enterprise repos that included an upgrade from ASP.NET Core 2.0 to 2.1.在对我们的一个企业存储库进行更改(包括从 ASP.NET Core 2.0 升级到 2.1)后,我还遇到了 Intellisense 突然消失的情况。 Strangely, at the same time, Intellisense was working fine in another C# project repo running ASP.NET Core 2.2.奇怪的是,与此同时,Intellisense 在另一个运行 ASP.NET Core 2.2 的 C# 项目存储库中运行良好。

For the project in question, I was puzzled to see successful logs for each reboot of the Omnisharp server as well as perfectly clean builds and runs.对于有问题的项目,我很困惑地看到 Omnisharp 服务器每次重新启动的成功日志以及完全干净的构建和运行。 The puzzlement increased as I compared these Omnisharp logs to those from the 2.2 project and found them effectively identical.当我将这些 Omnisharp 日志与 2.2 项目中的日志进行比较并发现它们实际上相同时,我的困惑增加了。

Upon uninstalling Mono, the one detail that changed is how Omnisharp started.卸载 Mono 后,发生变化的一个细节是 Omnisharp 的启动方式。 Now it boots up from a shell script located at ~/.vscode/extensions/ms-vscode.csharp-1.19.0/.omnisharp/1.32.18/run .现在它从位于~/.vscode/extensions/ms-vscode.csharp-1.19.0/.omnisharp/1.32.18/run的 shell 脚本~/.vscode/extensions/ms-vscode.csharp-1.19.0/.omnisharp/1.32.18/run Previously, Mono itself was booting the server from the executable at ~/.vscode/extensions/ms-vscode.csharp-1.19.0/.omnisharp/1.32.18/omnisharp/Omnisharp.exe .以前,Mono 本身从~/.vscode/extensions/ms-vscode.csharp-1.19.0/.omnisharp/1.32.18/omnisharp/Omnisharp.exe处的可执行文件启动服务器。

Other troubleshooting I attempted in this instance though to no avail:我在这种情况下尝试的其他故障排除虽然无济于事:

  • dotnet clean / Deleting bin and obj directories dotnet clean / 删除 bin 和 obj 目录
  • Updating launch.json to point at the proper /bin/Debug/netcoreapp2.1 build directory更新launch.json以指向正确的/bin/Debug/netcoreapp2.1构建目录
  • Wiping my local nuget cache擦除我的本地 nuget 缓存
  • Restarting Omnisharp重启 Omnisharp
  • Uninstalling and reinstalling VS Code, as well as bumping back a version from 1.33.1 as the breakage coincided oddly with the March 2019 update卸载并重新安装 VS Code,以及从 1.33.1 退回一个版本,因为损坏与 2019 年 3 月的更新奇怪地重合
  • Uninstalling and reinstalling the C# VS Code extension, as well as bumping back a version from 1.19.0 given other users' reports of said version interfering with Intellisense for certain projects*卸载并重新安装 C# VS Code 扩展,以及根据其他用户报告该版本干扰某些项目的 Intellisense*,从 1.19.0 退回版本
  • Adding a global.json file at project root to override default utilization of latest .NET Core SDK (mine was 2.2.105) and run instead using 2.1.302 in concert with the project's version在项目根目录添加global.json文件以覆盖最新 .NET Core SDK(我的是 2.2.105)的默认使用,并使用与项目版本一致的 2.1.302 运行
  • Wiping/rebuilding the project .sln file擦除/重建项目.sln文件

Specs : VS Code 1.33.1, C# Extension 1.19.0, MacOS High Sierra 10.13.6.规格:VS Code 1.33.1,C# 扩展 1.19.0,MacOS High Sierra 10.13.6。


*NB : As it turns out, in another .NET Core 2.1 project with the same issues in VS Code as described above, uninstalling Mono alone did not fix things. *注意:事实证明,在另一个.NET Core 2.1 项目中,VS Code 中存在与上述相同的问题,单独卸载 Mono 并不能解决问题。 I also did wind up needing to bump back the C# extension to v. 1.18.0 to recover Intellisense.我也确实需要将 C# 扩展回滚到 v. 1.18.0 以恢复 Intellisense。 Weird.奇怪的。

This case was for an existing project that was working fine before.此案例适用于之前运行良好的现有项目。 Opened via the vs code "recent" history.通过 vs 代码“最近”历史记录打开。

For dotnet core.对于 dotnet 核心。 I opened my project's *.csprog file, made no changes, and saved it via the vs code editor.我打开了我项目的 *.csprog 文件,没有做任何更改,并通过 vs 代码编辑器保存它。

As soon as I saved, all of the intellisense stuff starting working again in my other files within that project.我一保存,所有的智能感知内容就会在该项目中的其他文件中再次开始工作。

The issue I had was OmniSharp was an older version.我遇到的问题是OmniSharp是旧版本。 I set the flag to update to latest version in Settings.json file.我在Settings.json文件中Settings.json了更新到最新版本的标志。 This ensures the extension is always the latest version.这可确保扩展程序始终是最新版本。

"omnisharp.path": "latest"

And restarted VS code.并重新启动VS代码。 That fixed it for me.那为我修好了。

I've had some good experiences in C# with this extension so far: https://marketplace.visualstudio.com/items?itemName=jchannon.csharpextensions到目前为止,我在 C# 中使用此扩展获得了一些很好的经验: https : //marketplace.visualstudio.com/items?itemName=jchannon.csharpextensions

"This extension traverses up the folder tree to find the project.json or *.csproj and uses that as the parent folder to determine namespaces." “此扩展程序向上遍历文件夹树以查找 project.json 或 *.csproj,并将其用作父文件夹来确定命名空间。”

我使用Task Manager并终止Visual Studio Code process ,然后重新启动Visual Studio Code ,智能感知显示并修复。

Try "Install Extension" from command Pallete - probably if C# intellisense is not there:从命令 Pallete 尝试“安装扩展” - 可能如果 C# intellisense 不存在:

在此处输入图片说明

https://code.visualstudio.com/docs/customization/colorizer https://code.visualstudio.com/docs/customization/colorizer

if intellisense in not working for react js or javascript or node js this solution will help for windows如果智能感知不适用于 react js 或 javascript 或 node js,则此解决方案将有助于 Windows

  1. uninistall type script by typing npm uninstall -g typescript通过键入npm uninstall -g typescript typescript 来npm uninstall -g typescript脚本
  2. install specific version of type script that is 3.3 by typing npm install -g typescript@3.3通过键入npm install -g typescript@3.3安装特定版本的类型脚本,即 3.3
  3. add the typescript location in vscode by navigating to file > Preferences > settings > here search for edit in setting.json then add this path "typescript.tsdk": "/Users/yourusename/AppData/Roaming/npm/node_modules/typescript/lib"通过导航到文件 > 首选项 > 设置 > edit in setting.json搜索edit in setting.json然后添加此路径"typescript.tsdk": "/Users/yourusename/AppData/Roaming/npm/node_modules/typescript/lib"在 vscode 中添加打字稿位置"typescript.tsdk": "/Users/yourusename/AppData/Roaming/npm/node_modules/typescript/lib"
  4. settings.json should look someting like this settings.json 应该看起来像这样
{ "editor.suggestSelection": "first", "vsintellicode.modify.editor.suggestSelection":"automaticallyOverrodeDefaultValue", "typescript.tsdk": "/Users/yourusername/AppData/Roaming/npm/node_modules/typescript/lib" }

I was able to fix this by changing the Api Compatibility Level from .Net Standard 2.0 to .NT 4.x.我能够通过将 Api 兼容性级别从 .Net Standard 2.0 更改为 .NT 4.x 来解决此问题。 You can find this setting on Project Settings / Player.您可以在项目设置/播放器上找到此设置。 After that, intellisense started working again.之后,智能感知再次开始工作。 在此处输入图片说明

Downgrading to 1.23.9 of the C# VS Code extension fixed the intellisense for me.降级到1.23.9的 C# VS Code 扩展修复了我的智能感知。 So if nothing else is working for you, perhaps try installing an older version of the extension (doesn't necessarily have to be that exact one I mentioned).因此,如果没有其他方法适合您,请尝试安装旧版本的扩展程序(不一定必须是我提到的那个确切版本)。 You can do this by selecting this option in VS Code:您可以通过在 VS Code 中选择此选项来执行此操作: 在此处输入图片说明

I fixed this with a multiple project solution in .net5 / .net core 3.1 by opening each project (not the sln folder) in VSCODE.我通过在 VSCODE 中打开每个项目(不是 sln 文件夹),在 .net5/.net core 3.1 中使用多项目解决方案解决了这个问题。 This then prompts to add the resources/ .CSX?然后提示添加资源/.CSX? files to the project;项目文件; enabling intellisense, per project.每个项目启用智能感知。 Finally close that window and reopen the solution folder and all works as expected.最后关闭该窗口并重新打开解决方案文件夹,一切都按预期工作。

See image Add VSCode assets查看图片添加 VSCode 资产

Downgrading to 1.23.9 of C# for Visual Studio Code (powered by OmniSharp).降级到 C# 的 1.23.9 for Visual Studio Code(由 OmniSharp 提供支持)。 https://i.stack.imgur.com/VrdJl.png https://i.stack.imgur.com/VrdJl.png

After trying several things I looked at the OmniSharp logs only to realize that because I had two different sln files in my workspace.在尝试了几件事之后,我查看了 OmniSharp 日志才意识到这是因为我的工作区中有两个不同的 sln 文件。 It had picked up the “other” one and thus wasn't working.它已经拿起了“另一个”,因此无法正常工作。 I deleted it, reopened vs code, and all is well again.我删除了它,重新打开 vs 代码,一切又好了。

For me I had been working without internet for a long time.对我来说,我在没有互联网的情况下工作了很长时间。 It had previously been working but then stopped.它以前一直在工作,但后来停止了。 I closed+reopened VSCode with a stable wifi connection and the Output tab in VSCode popped up, displaying the the extensions were re-installing.我使用稳定的 wifi 连接关闭+重新打开 VSCode,并弹出 VSCode 中的“ Output选项卡,显示正在重新安装扩展。 After that it worked!之后它起作用了!

就我而言,未启用扩展

I just had this happen ( this being no code completion suggestions appearing).我刚刚发生了这种情况(是没有出现代码完成建议)。 What resolved it for me was changing the VSCode Editor package in Unity to a previous version and then back to the current version.为我解决的是将 Unity 中的 VSCode 编辑器包更改为以前的版本,然后再返回到当前版本。

For me, this was going from 1.2.0 to 1.1.3 and then back to 1.2.0.对我来说,这是从 1.2.0 到 1.1.3,然后又回到 1.2.0。 I believe removing and reinstalling 1.2.0 would have accomplished the same.我相信删除并重新安装 1.2.0 也会达到同样的效果。

Window > Package Manager > Visual Studio Code Editor窗口 > 包管理器 > Visual Studio 代码编辑器

I know this is probably the most obvious answer.我知道这可能是最明显的答案。 But I had enough dealing with VS Code ridiculous bugs.但是我已经受够了处理 VS Code 荒谬的错误。 You should be focusing on code, not the buggy IDE.您应该关注代码,而不是有缺陷的 IDE。 Their documentation doesn't make it easy either to debug.他们的文档也不容易调试。

Steps for complete uninstallation:完全卸载的步骤:

  1. Save your personalization files such as keybindings.json ,保存您的个性化文件,例如keybindings.json

Just put it on GitHub or something so whenever you need have trouble with VS Code you simply just need to go to GitHub and copy-paste it.只需将它放在 GitHub 或其他东西上,所以当你需要使用 VS Code 时,你只需要去 GitHub 并复制粘贴它。

  1. Uninstall VS Code completely完全卸载 VS Code

When you uninstalled VS Code, it doesn't erase your extension files and some old settings.当您卸载 VS Code 时,它​​不会删除您的扩展文件和一些旧设置。 This is the cause of the re-installation ended up the same.这就是重新安装最终结果相同的原因。 Horrible move VS Code.可怕的举动 VS Code。 For the list of the files that you must delete, you can check out this answer .有关您必须删除的文件列表,您可以查看此答案

  1. Go to their website and install the new one.转到他们的网站并安装新的。

I hope this helps some people who are already had enough with the VS Code ridiculous bug.我希望这可以帮助一些已经受够了 VS Code 荒谬错误的人。

In my case, the issue was not with VS Code settings.就我而言,问题不在于 VS Code 设置。 The error was due to a corrupted TEMP path configured in my PC's registry user profile environment settings.该错误是由于我 PC 的注册表用户配置文件环境设置中配置的 TEMP 路径损坏造成的。 I got this error from Help --> Toggle Developer Tools --> Console The error was flagged in the console when I opened a new typescript file.我从帮助 --> 切换开发人员工具 --> 控制台中收到此错误当我打开一个新的打字稿文件时,控制台中标记了错误。

Unable to write file c:\Users\XXX\AppData\Local\Temp;C:\wamp64\bin\php\php5.6.25;C:\vufind-3.1.2\install.php\09cf49d8-af5b-42e9-8194-43f5b566be0f'

Obviously this path was corrupted.显然这条路径被破坏了。 After updating the environment variables in registry settings, the VS code IntelliSense started working.更新注册表设置中的环境变量后,VS 代码 IntelliSense 开始工作。 Checking the console is a good start to find the root cause of this issue.检查控制台是找到此问题根本原因的良好开端。

只需重新安装扩展并重新启动 VSCode/PC。

Earlier intellisense was working for Angular in VS-Code but for some reason (which I don't know) intellisense stopped working.早期的智能感知在VS-CodeAngular工作,但由于某种原因(我不知道)智能感知停止工作。 I had extensions installed ie Angular Essentials and Angular Language Service etc. that were responsible for this intellisense and all that.我安装了扩展,即Angular EssentialsAngular Language Service等,它们负责这个智能感知和所有这些。

What I did?我做了什么?

I disabled the extensions , restarted VS Code and enabled them.我禁用了extensions ,重新启动了VS Code并启用了它们。 It was all working fine as before.一切都像以前一样正常。

If everything in VSCode is working ( No errors in output console, language server is working etc.) and built-in extensions are enabled.如果 VSCode 中的一切正常(输出控制台中没有错误,语言服务器正在工作等)并且启用了内置扩展。 Still, if your IntelliSense is not working for normal .js files make sure variables are defined with a type identifier such as var d = new Date() or let d = new Date() .尽管如此,如果您的 IntelliSense 不适用于普通的.js文件,请确保使用类型标识符定义变量,例如var d = new Date()let d = new Date() In my case, IntelliSense was not working for d = new Date() (No autocomplete for Date object 'd' APIs in this way) but started working fine when I specified a type before my variable names.就我而言,IntelliSense 不适用于d = new Date() (No autocomplete for Date object 'd' APIs in this way)但是当我在变量名之前指定类型时开始正常工作。

下载并安装“Tool for Visual Studio 2019”作为引擎盖下的 C# 扩展使用构建工具: https : //visualstudio.microsoft.com/downloads/

In my case, I had an extension installed ( Explorer Exclude ) to help me focus and hide certain files that I don't regularly work with within the Explorer.就我而言,我安装了一个扩展程序( Explorer Exclude )来帮助我集中注意力并隐藏我不经常在 Explorer 中使用的某些文件。

I so happened to have disabled viewing *.sln, *.csproj and *.vsconfig files and folders, which apparently prevents VSCode from even knowing the file is there in the first place.我碰巧禁用了查看 *.sln、*.csproj 和 *.vsconfig 文件和文件夹,这显然阻止了 VSCode 甚至首先知道文件在那里。 Disabling these specific rules solved the problem instantly.禁用这些特定规则立即解决了问题。

Took me ages to figure out... The more you know.我花了很长时间才弄清楚......你知道的越多。

I solved it by uninstalling all SDK's (not sure if this is needed) and installed 4.7.1 developer pack我通过卸载所有 SDK(不确定是否需要)并安装4.7.1 开发包来解决它

win 10, vscode 1.63.2, unity 2020.3.25f1 win 10,vscode 1.63.2,unity 2020.3.25f1

I fixed this by installing .NET Framework 4.7.1 Developer Pack:我通过安装 .NET Framework 4.7.1 Developer Pack 解决了这个问题:

https:\/\/dotnet.microsoft.com\/en-us\/download\/dotnet-framework\/net471<\/a> https:\/\/dotnet.microsoft.com\/en-us\/download\/dotnet-framework\/net471<\/a>

"

Wow, so many answers... and some of them are very old... but lots of clues to help fix things:)哇,这么多答案......其中一些已经很老了......但是有很多线索可以帮助解决问题:)

As of Dec 2022, here's what worked for me, for using Unity:截至 2022 年 12 月,对于使用 Unity,以下是对我有用的方法:

  • everything does indeed hinge on the "C# for Visual Studio Code (powered by OmniSharp)" plugin一切确实都取决于“C# for Visual Studio Code(由 OmniSharp 提供支持)”插件
  • however, rather than downgrading to 1.23.9, what I did was, following the instructions in the main page:但是,我没有降级到 1.23.9,而是按照主页中的说明进行操作:
    • in the settings, uncheck 'Omnisharp: Use Modern Net'在设置中,取消选中“Omnisharp:使用现代网络” 在此处输入图像描述
    • follow the instructions to download and install Mono按照说明下载并安装 Mono
    • restarted by VSC a couple of times由 VSC 重启几次
    • => Unity autocomplete started working:) => Unity 自动完成开始工作:)

To fix this, I had to go on Unity to "Preferences" then in "External tools" tab.要解决此问题,我必须在 Unity 上将 go 转到“首选项”,然后在“外部工具”选项卡中。

For the "External Script Editor", "Visual Studio Code" was already selected.对于“外部脚本编辑器”,已经选择了“Visual Studio Code”。

I clicked on "Reset argument", then for "Generate.csproj files for:" nothing was selected.我点击了“重置参数”,然后点击了“Generate.csproj files for:”,没有选择任何东西。 Then I clicked on "Regenerate project files".然后我点击“重新生成项目文件”。

Then I reloaded VS Code and Intellisense was working.然后我重新加载了 VS Code,Intellisense 开始工作了。

Clearing typescript cache and downgrading the typescript version to 3.3 solved the issue for me.清除打字稿缓存并将打字稿版本降级到 3.3 为我解决了这个问题。

Follow these steps to clear cache and downgrade typescript version:按照以下步骤清除缓存并降级打字稿版本:

  1. Enter following command in terminal according to your OS and delete whatever is inside it.根据您的操作系统在终端中输入以下命令并删除其中的任何内容。
  • Mac: ~/Library/Caches/TypeScript/ Mac: ~/Library/Caches/TypeScript/
  • Windows: %LOCALAPPDATA%\\Microsoft\\TypeScript\\ (windows users can run this in run box too) Windows: %LOCALAPPDATA%\\Microsoft\\TypeScript\\ (Windows 用户也可以在运行框中运行它)
  • Linux: ~/.cache/typescript/ Linux: ~/.cache/typescript/
  1. Install this specific @typescript@3.3 using following command.使用以下命令安装此特定的@typescript@3.3
  • npm install -g typescript@3.3
  1. Restart VSCode.重新启动 VSCode。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM