Flutter VS Code Quick Fix not suggesting import - flutter

Everything worked fine until a couple of days ago. Whenever I create new widgets or create some files and want to use them, I don't manually type import package:... but start typing the name of that class and press ctrl + . which provided a list of Quick fixes and always suggested import package:... until recently. No changes to Windows / Flutter / Dart / VS Code have been made except I installed svg-explorer-extension after following this advice (which I would highly doubt affected anything, yet it still updated some x64 c++ distribution something).
Right now, as I try to use existing files (all of them are in */lib folder) in the new files I create, the Quick fix menu provides all except import package:... options which makes the development process slow enough to ask a question here.
The only way to 'recover' that functionality is to run Developer: Reload Window in VS Code which stops the debug session, restarts Dart Analyzer, and everything seems to be okay for the next couple of minutes until it simply disappears.
How to not 'lose' that importing functionality? My project is rather big (22k lines) with 30+ dependencies. I tried reinstalling flutter SDK, flutter, and dart extensions from VS Code and that didn't help.
What suggestions do you have? Is this issue worth filing an issue for Flutter / Dart / Flutter Extension on GitHub?

Happening with recently and was fixed with the restart to update option.
It was so annoying and wasted my 1 hour searching over google and StackOverflow.

I was also stucked in this issue and the real answer to this question according to my analysis is : always create new widgets or dart classes within lib folder. You can create different folders such as widgets, screens, models but always create them in lib folder dont create them at the root level. Your problem of import will be solved. Infact VSCode will auto-import them
You can refer to this image below and see how I organized my lib folder
[1]: https://i.stack.imgur.com/Yau5i.png

Related

VS Code won't autosuggest when importing a file

(Currently using VS Code on macOS Monterey, mostly for React and JavaScript.)
When I used to import a component at the top of my file, Vs Code would suggest the path of the file. I would simply press enter or click on the suggestion and VS Code would fill in the rest. Seems to me like a standard feature of VS Code, and I've grown pretty accustomed to it.
Now, it doesn't suggest anything. I'll type out a file that exists in the project, and nothing appears. I've tried it with several projects, and none of them suggest anything anymore — when just last week it was working fine.
trying to import
One thing... I have a lingering suspicion that it's from doing this:
npm i #types/react -g
A friend recommended I add it. With it, you can declare a component in your project and VS Code will auto import it. Really, it's the only thing I can remember changing since this strange behavior with VS Code started, but I'm not positive. Just a suspicion. I've tried to remove it, but it didn't fix anything.
I've done a bunch of stuff found on stackoverflow already with no improvements:
adding to setting.json, like this, or this
even deleted VS Code w/ extensions

Flutter broken after gitlab commit // Help needed

I'm using the source controle feature in Visual Code to have my Flutter project backed up via Gitlab. About two days ago, suddenly I had Flutter in the list of projects that can be committed/synchronised. I made the mistakte of pressing the button. It did something and then told me there are conflicts merging files.
Now everything is broken, If I try running my project I get a really long list of errors I do not understand (see below). Flutter in source control has loads of red exclamation marks. I'm a beginner and completely out of my depth here. So I dont wan't to touch more things I don't fully understand.
Can anyone give me a hint whow to fix this mess without breakting more things?
Erorr messages:
Blockquote
And a lot more like this below.

Cannot create a flutter app using flutter create

When i run flutter create I get
Im not sure why that png is a sticking point everything above it are in the same parent folders. Has anyone run into this issue?The Programming Flutter folder seems like it is being set as read only:
But when i uncheck the Read only box and click apply when i open it again its set to Read Only again. But thats the very parent folder and other files seem to copy across fine before the error above.
Anyone have any idea why its failing?
Have you recently updated your Flutter version, or are you running on an older version? As per this thread, it seems to have been fixed somewhere in 2020.
It is your operating system not allowing Flutter to write files.
You can either delete that folder and create that again or change permissions. Uncheck that 'read-only' checkbox shown in picture.
You can learn more about handling permissions here.

Unity3D 2020 - VSCode - What happened to intellisense?

Overnight, any help I had for Unity3D in VSCode, i.e. intellisense, disappeared. And I get the sense, no pun intended, that I'm not the only one who's afflicted.
I've tried updating and reinstalling what I assumed VSCode needed to make Unity3D intellisense work. And have checked and re-checked settings, reinstalled VSCode package, in Unity3D.
I've worked through a few tutorials that claimed to address the issue.
What else does VSCode depend on to make this relationship work?
Thanks! Here's to hoping you've fixed this and your life has gotten easier!
Try going to Edit > Preferences > External Tools > Regenerate Project Files (This is because of a bug where the VS Code extension doesn't generate the project files correctly the first time, you can check it out here).
You'll need to be using the VS Code Editor Extension 1.2.0 (you can check which version you're using in the package manager) or later for that option to appear. Also if for whatever reason there are 2 .sln files in your project folder (I've had that happen before, though it's less likely), that also causes problems.
Ok. First, thanks to Lightning_A and Charleh!
The resolution to my specific circumstance was to install the VSCode extension "Unity Snippets Modified" https://github.com/with-heart/vscode-unity-snippets
I had been using https://github.com/kleber-swf/vscode-unity-code-snippets.
Perhaps it's just a matter of Kleber's extension, which is/was great, was broken upon updating Unity to 2020? I dunno and don't have the time to look into it, unfortunately.
Hopefully, my question, the answers I received, and my subsequent resolution saves others from the rabbit-hole I went down.
Again, thanks everyone!

Xcode 7.3 autocomplete is so frustrating

There is a new autocomplete in Xcode. Probably might be useful because it checks not only beginning of names etc. But I found that very often it doesn't find a class name or a const name at all etc. I need to type in entire name by myself. Over all I found it makes my life harder and coding more time consuming. Is there a way to switch to the old way it used to work?
Xcode 7.3.1
In Xcode > Preferences > Text Editing
uncheck Enable type-over completions
restart Xcode
It seems that clearing the checkbox "Enable type-over completions" in XCode -> Preferences -> Text Editing does the trick. At least in my case autocompletion fell back to a sort of old way, so it could autocomplete the class name that I had to type in manually before that.
This is by no means an adequate solution, BUT it has allowed me to (barely) maintain my sanity the past few days:
After every build, you need to trash your Derived Data folder. You can find this folder in Xcode > Preferences > Locations > Derived Data. Just trash the whole thing and it'll kick off a re-indexing step that should restore proper autocomplete functionality.
Unfortunately, I've found that once I build, the autocomplete behavior reverts to its broken state.
just open Xcode derived data folder and delete the folder
/Users/yourUserName/Library/Developer/Xcode/DerivedData
then restart Xcode, now autocompletion works like a charm
I have the impression that some 'parts' of autocompletion simply fail after a while. I use to restart the Mac to get it back working. But sometimes it fails quite soon again.
Maybe the answer of #Alex Bykov combined with a restart will do the trick.
Anyway: auto-completion of Xcode always was crap. AppCode used to get it much better. Unfortunately not yet with swift.
Closed Xcode, opened Xcode, let it index, it worked.
it doesn't find a class name
As a work-around, you can try to press
Command + Shift + K and Command + B
Several times,it works temporarily.
Xcode 7.3.1
I will share another posible reason, that after couple of days we found out. We have multiple schemes, and in one of them, the bridging header was importing a file that didn't exist anymore. So, it didn't break while compiling and running (the header belongs to another scheme) but it caused the autocompletion to break (couldn't find any objective-c class).
Hope it would help someone!
After having tried different methods:
Delete Derived Data
Switching Module Enabled off in Build Settings
Full Clean
Relaunch
Only this worked:
Find any commented out (/* abc */) code after #end in your files and delete.
Credit to Max_B:
https://forums.developer.apple.com/thread/7439
In my case, other projects were auto-completing correctly. If all your projects fail to correctly predict code, then it might be a different issue, and the other answers might work.
I ran into this issue while trying to make an OS X app and I was able to fix this issue by making sure that the Xcode 7.3 documentation and the OS X 10.11.4 documentation was actually downloaded. Doing this fully restored my autocomplete functionality. My full instructions are below as well as in my answer to a similar question: https://stackoverflow.com/a/39420664/3444925
I had this problem myself and after looking through all the other similar questions & answers about this, I couldn't find a solution. However, I finally found what worked for me.
Go to Xcode -> Preferences -> Components. There you will probably find a screen that looks like the following:
This shows that the documentation has not has not been downloaded and therefore, any attempts to re-index or re-build the application without downloading the documentation would prevent you from being able to use the autocompletion functionality.
Once I downloaded the Xcode 7.3 Documentation and the OSX 10.11.4 Documentation, this was enough for me to get the autocomplete functionality back (I was trying to build an OS X app, so feel free to download as much documentation as is relevant for you).
I didn't run into this until I created a couple of new class files. Other classes worked fine, but autocomplete would NOT work for anything in the new files...
FIX (for me) - I had to add those files to ALL of my targets, including the unit test targets even though I wasn't using them yet.