Change Auto-Import Priority Order In VScode - visual-studio-code

I'm working on a Next-JS project with TypeScript.
Everything was fine till one day, VSCode decided to change my auto-import priorty.
In my case, I wanted to import useEffect, useContext,.. from react. But somehow, Vscode auto-import first-place changed to preact-hook, which is different from react and take me time to debug it later when I test the code.
Any Idea how can I change the order to let react goes first?

Related

How do I get imports to show up when I press ctrl+dot in javascript in vscode?

When writing JSX (or any typescript code really) if you have an available import that's not yet imported, you get a squiggly line under it and can press ctrl+dot on it and then automatically import the code as a "refactoring."
How can I set this up in Javascript? I've seen a screenshot of someone else's VSC where it is available underneath "more options" and so I'm pretty sure it's possible, but when I press ctrl+dot I get nothing.
Note: I'm aware I can press ctrl+space. However, I don't want to do this, for two reasons. (1) alt+space is pretty bad UX because if you press it in the middle of a word it continues to autocomplete even if you already had the full name there and so you are left with an incorrect tag (e.g. if your cursor was after the d in Keyboard for a component called KeyboardRow you are left with KeyboardRowRow) and (2) I want to rebind quick fix to alt+enter to match pycharm; and I want the same hotkey & UX in both Typescript and Javascript.
I haven't worked too much with JS, mainly with TS, but I have two extensions installed in my vscode that helped me a lot while coding in vanilla JS.
Path intellisense and Auto import
You can try if My Code Actions can be used to construct a Quick Fix for these types of PROBLEMS/squiggles

How do I keybind nx console's "build" without additional mouse clicks in vscode?

I am using nx console in conjunction with storybook for a project.
Whenever I make a CSS change, I am forced to completely rebuild with NX console. This is both tedious and time consuming.
I have attempted to keybind "build," but this only takes me to the screen where I push run. This workflow is still cumbersome and incredibly time consuming with the amount of CSS changes I am having to make. For every single change I make, I must completely rebuild the project.
Does anyone know how I can force a keybinding to "build" that will force the project to rebuild without additional input?

Change VS Code to auto-import files in flutter relatively

So, here is the problem:
Whenever I am coding with Flutter and Dart, and I use a feature from another file, when I press Tab, VS Code will auto-import the file for me.
The thing is, VS Code will use the package import syntax, like import 'package:<project_name>/<file_path>';. But I prefer relative import syntax.
So, is there a setting I can change in VS Code for Dart to configure it to use relative imports by default?
Thanks!
While importing, you can find both option by tapping on yellow bulb or pressing ctrl+.
Another handy thing, using dart-import extension on Vs-code.
Personally, I am using dart-import extension. There is an extension setting you can turn on to modify imports on save. So, you can have a consistent import structure without needing to choose every single time.
There is a recommendation in effective dart guideline for relative path import usage.

VS Code Autocomplete Re-imports Package with Full Path

Every time I want to add a widget by selecting it on the autocomplete list from VS Code, let it be a Container, Column, etc., the full path is re-imported. Sometimes the autocomplete list will also show multiple lines for the same widget. import 'package:flutter/material.dart';' is already included on the file.
e.g.
import '../../../../../flutter_linux_v1.0.0-stable/flutter/packages/flutter/lib/src/widgets/framework.dart';
import '../../../../../flutter_linux_v1.0.0-stable/flutter/packages/flutter/lib/src/widgets/container.dart';
Image here: screenshot of autocomplete
It goes away if I run Flutter clean but comes right back. Any ideas to make this go away?
Which extensions are you using? Might there might be some extensions which is overriding flutters default extension behaviour.
You can run code --list-extensions from command line to get all extension installed. You can post it here so that me or someone else can help you out.

Automatically import necessary classes in Android Activities without Eclipse or Android Studio

I have a question. If there's any possibility to automatically import necessary classes when I work with Activities in text editor (gedit) or Netbeans? Because Android Studio is incredibly slow on my PC.
I mean import android.app.Activity import android.os.Bundle etc.
RTFM:
according to Netbeans doc:
There are several ways of how you can work with import statements. The IDE's Java Editor constantly checks your code for the correct use of import statements and immediately warns you when non-imported classes or unused import statements are detected.
When a non-imported class is found, the Bulb error icon error mark appears in the IDE's lefthand margin (this margin is also called the glyph margin). Click the error mark and choose whether to add the missing import or create this class in the current package.
While you are typing, press Ctrl-Shift-I (or choose Source > Fix Imports from the menu) to add all missing import statements at once.
Press Alt-Shift-I to add an import only for the type at which the cursor is located.
When you select a class from the code completion window, the Editor automatically adds an import statement for it, so you do not need to worry about this.