Refactor flutter code not avilable in vs code - flutter

vs code suddenly not showing the refactoring option on any code on dart.. If I press ctrl+shift+R on any widget or class it says no refactoring enter image description hereavailable..

Turning dart lps analyzer off solved the problem for me

Place your cursor in the widget you want to edit and use CTRL + . shortcut to see the options. Use CMD + . for MacOS. To do it manually in VS Code.
And For Android Studio its option + return in Mac and Alt + Enter in Windows.
See this For A Reference

Related

list arguments in vs code

I am switching from android studio to VScode for flutter development and, obviously, there are some shortcuts that on android studio different from those on VScode. One of those shortcuts that I could not find is the listing of all arguments of a widget. I am looking for a shortcut that lists all the args without entering any letter.
I used cmd + space and nothing happend. I also used shift + cmd + space and gave me something I am not looking for. So can anyone help me with that?
CTRL + space works.
To check your keybinding, go to Preferences > Keyboard Shortcuts, and search for Trigger Suggest.
But also make sure you have the Flutter & Dart extension to get code hint/completion:
Dart: https://marketplace.visualstudio.com/items?itemName=Dart-Code.dart-code.
Flutter: https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
Just CTRL + space works for me. I installed Intellij keymap as an extension on my VSCode too Here is an image of my vscode.
Sugestions without type anything
For a given widget VS Code auto-completion provide both method and class, respectively purple and yellow symbols.
An option is to select the class of the widget you want to use instead of the method in the auto-completion list. Then, as soon as you will add the opening parenthesis, all arguments will be listed and available for selection.

Flutter Outline Shows "Nothing to show" in android studio

I am trying to extract a Widget via Flutter Outline, but I am facing below problem in Android Studio.
Flutter Outline Shows "Nothing to show"
After running
flutter doctor -v
It shows:
How to overcome this problem?
Move the mouse to any widget and Press Ctrl (or ⌘ command on macOS) and click on that widget.
After this step, your Flutter Outline will be enabled and showing widget tree
Click to red dart analysis server button, hopefully it will work
MacOS: command + click on widget.
Windows: ctrl + click on widget.
If they do not work, do not worry! Follow these easy steps:
Click Dart Analysis (on below part of Android Studio)
You can see refresh button right side of Dart Analysis
Click it, done!
You can see image, click it:
Enable this then the outline will work:
I have same issues.
I just restart IntelliJ/Android studio and every time it's enough.
go to project directory on terminal by hitting,
cd project_directory
then,
flutter pub upgrade
click on a widget to select one
press control and click the widget again (you will be directed to widget class)
go back to the first window and the outline should be displayed

In VSCode, how do you stop code that is running via the Code Runner extension?

I'm running a python flask server locally by clicking the run button in VSCode (provided by the Code Runner extension).
How do I stop the server without closing and restarting VSCode?
From the Code Runner extension marketplace page, you have the following options:
To stop the running code:
use shortcut Ctrl + Alt + M
or press F1 and then select/type Stop Code Run
or right click the Output Channel and then click Stop Code Run in context menu
YMMV with the Ctrl + Alt + M shortcut, which does not work for me for some reason.
Mihai Chelaru has already answered the question, but I just wanted to let everyone know that by changing from Ctrl + Alt + M to e.g. Ctrl + Alt + B, the code run does stop.
For accepting input you should do the below setting otherwise, it will show code is running
Go to the setting and type 'code runner'
scroll down a little bit, find this 'code-runner: run in terminal' and check this.
Restart VsCode.
Check the pictures I attach :)
enter image description here
You can use these methods to solve your problem:
Press Ctr+Alt+M to clear your previous output and then run the code again.
You can go to the bottom left of your VS Code page and click on Settings (a gear icon) and select Settings. Then type "code runner" and select the first option "Clear the previous output." That's it.
Use Ctrl+Alt+M or F1 and then select/type Stop Code Run
Other useful Code Runner Commands you can use can be found here:
CodeRunner

How can I "Add Next Occurrence" in Visual Studio for Mac?

In Visual Studio Code and Sublime Text there is functionality called "Add Next Occurrence" that selects next occurrence of marked text. The keyboard shortcut for utilizing this function is CMD+D (CTRL+D on Windows and Linux).
This function would select the next occurrence of the text and also add another cursor to the end of the newly selected text.
How can I achieve this in Visual Studio for Mac?
The shortcut is: ⇧ + ⌥ + .
(Shift + Option + .)
And its name in the settings is: "Insert next matching caret"
At the moment this answer is the only one working for Visual Studio (tested in 8.9). All the others are for Visual Studio Code.
Unfortunately, this is not currently supported. There is however an open suggestion to the team that you can up-vote if you would like to see this feature in an upcoming release.
Here is the link to the feature request: https://developercommunity.visualstudio.com/content/idea/351843/multiple-selection-with-the-keyboard.html
In Mac, CMD + D will do the job.

How do you auto import libraries in Visual Studio Code?

Usually in IntelliJ you have a shortcut for auto importing libraries.
Is there an equivalent for Visual Studio Code?
In the current version, 1.11.2, you can put your cursor in the error line.
You will see a bulb in the line number. Then click it or press the shortcut ⌘ + . (Quick Fix).
That will pop up a import hint window, as follows
Currently there is no support for this in Visual Studio Code, but it's a good idea for an extension.