Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellisense not working in code snippets - VS Code

Tags:

I have installed the C# extension in VS Code. The problem I am having is, after using a code snippet prop, Intellisense no longer suggests variable types. This happens with other things like ctor as well, it will not autocomplete the class name, for example.

I have tried uninstalling/reinstalling the extension. I have Googled without luck as well.

I expect for Intellisense to suggest variable types, for example. Intellisense does not suggest anything.

Hitting Ctrl+. does suggest the correct fix among the list.

Edit: My project does not have a project.json or *.sln file. I created the project using the command line dotnet new webapi. If that is what is required, how do I add it or get Intellisense working?

like image 553
Richie Avatar asked Apr 15 '19 05:04

Richie


People also ask

Why IntelliSense doesn't work in VS Code?

Why is VS Code suggestions not working? If you're coding in JavaScript or TypeScript and finds that VSCode IntelliSense does work but does not behave properly, it's likely that you've selected the wrong language mode. TypeScript and JavaScript share the same language service, so you need to select the right language.

Why is VS Code snippets not working?

This fixed the problem for me: remove and then re-add all code snippet folders with the code snippet manager. Tools->Import and Export settings->Reset all settings. Chose reset and over write the existing settings options!

How do I enable IntelliSense in Visual Studio?

To access this options page, choose Tools > Options, and then choose Text Editor > C# > IntelliSense.


1 Answers

By default, intellisence / quick suggestions will not be triggered inside of a snippet. To enable them set

"editor.suggest.snippetsPreventQuickSuggestions": false 

true is the default.

Editor > Suggest: Snippets Prevent Quick Suggestions in the Settings UI.

like image 58
Mark Avatar answered Sep 24 '22 23:09

Mark