Get auto import completions without adding import statements - vscode-extensions

I have python embedded into my program and added a few functions using the Python C API. I'd like to get PyLance IntelliSense providing autocompletion for it.
After setting up paths to a dummy python file (with dummy functions), PyLance seems to suggest auto completions for my functions but also adds the top-level from x import y statements. I've tried to set the python.analysis.autoImportCompletions to false but it disables the autocompletion entirely.
So, how to get the autocompletion without PyLance adding the import statements at the top? (I know it's not practical but I think it suits my use case here)

Related

How do you import a reference to a dart file when you only know the file name? Extension methods and others

To import a file in Dart (using IntelliJ) I will usually use start typing the name of a function, class or variable and select enter. Alternatively I might type the name of the class and press alt+enter on it. This will then give me an option to import the file reference.
For extension methods this doesn't work and sometimes I know the name of the package (file) I want to import but can't remember the name of the function.
Is there a way to use the filename to lookup and insert an import statement with the full package address?
Edit
Unfortunately my originally accepted answer doesn't always work. For example with extension methods. I'm trying to add a reference and it seems impossible to do without typing the full reference to the extension.
Edit2
Found out there is an open issue to fix this
https://github.com/dart-lang/sdk/issues/40365
You can write import 'som...' and ctrl+space for auto-complete and get IntelliJ to make suggestion across all packages imported with pubspec and files across the project. If the file is inside a package, it will automatically insert the full path.

Rollup - Preserve modules + css

Can't find any resources online, but i'm trying to optimize our in-house component library, which i'm trying to make more tree shaker friendly.
How with rollup can i leave .css files in the output along with maintain their import in the file.
I.E
Foo.js (inside import "./foo.css")
Foo.css
Output.
Foo.js (inside import "./foo.css" remains) created into module
Foo.css
This seems as straight forward as possible and iv'e found similar threads asking for this but zero responses. https://github.com/egoist/rollup-plugin-postcss/issues/204
Allowing this will basically mean when people who consume my project will only get critical css automatically.
I.E Import { Foo } from "xyz/foo" will automatically import the accompanying css file.
Unfortunately I couldn't find a solution with Rollup for what you're looking for. However, if you're open to using Webpack there's a plugin that would make this possible called MiniCssExtractPlugin. It creates CSS files per JS file and would achieve the structure you're wanting.

pydev autocomplete for matplotlib

Here is the code I write in pydev combined with eclipse.
import matplotlib.pyplot as plt
fig=plt.figure()
as I know, 'fig' is a instance of 'matplotlib.Figure' class,when I write :
fig.
it seems pydev can't provide method calltip for fig. I cannot figure out what's going on, since for other module , like numpy, it works well.by the way, if i use a matlab-like interface, for example,
plt.plot()
pydev does provide the calltip for function arguments.
is there a way to solve this problem? I will appreciate it if anyone give a solution .
Forgive my poor english:-D
fig is an instance of matplotlib.figure.Figure so what you can do is importing import matplotlib.figure and creating an instance of that. Then, writing fig to the editor, you should get the tooltip you want.
The following is a screenshot from Spyder, so I haven't actually tested it in pydev.
I am not aware of any other possibility. The reason is that for the requested functionality to work the editor would need to load all kinds of modules, which are not actually imported in the script.
The issue is that some cases are too dynamic for PyDev to know about the actual type of the object that some method returns (which appears to be the case).
If you know the type, you can manually type it locally.
i.e.: Add the comment:
#: :type fig: matplotlib.figure.Figure
right before the fig assignment.
See: http://www.pydev.org/manual_adv_type_hints.html for more details.

Is there a way to have WebStorm complete a whole line?

Is there a way to have WebStorm complete a whole line?
I'm not looking for anything smart, just something like vim's i_CTRL-X_CTRL-L
This can come in handy for repetitive import statements on top of a file:
import Rea can be completed to import React from 'react'; that shows multiple times in other files of a project.
Based on their documentation, IntelliJ only supports the following Auto-Completing Code scenarios:
Basic code completion on ⌃Space.
Type completion on ⌃⇧Space.
Completing punctuation on ⏎.
Completing statements with smart ⏎.
Completing paths in the Select Path dialog.
Expanding words with ⌥/.
Negating expressions with an exclamation mark.
Various tips and tricks on using the suggestion lists that appear on invoking code completion.

Import UIKit for debugging Objective-C by default

Whenever I try to read the frame of an UIView for example while debugging, I get this error:
error: property 'frame not found on object of type 'UIView *'
error: 1 errors parsing expression
After searching for a solution, I found out that I can use this command to solve this without adding (annoying and in some cases complicated) casts:
expr #import UIKit;
But I still find it annoying to have to do this every time (why doesn't Xcode do this by default?!), so I thought I should be able to do this using the .lldbinit file, but I couldn't get it to work.
I don't know much about that file, I have this in it atm:
command script import /usr/local/opt/chisel/libexec/fblldb.py
so I tried adding the UIKit import command at the end of the file but it didn't look that it worked. I also tried prefixing it with command to no avail. Is this possible or not? (please say yes; it will save my life)
lldb will auto-import modules that the debug info tells us the program imports fairly soon now. All the pieces weren't in place to do that for the first Xcode 7 releases.
Statements in the .lldbinit get run before the main file is read in, it is supposed to help set up the environment to read in your program. But at that point there's nothing into which to import these symbols. You need to do it after the main binary is read in (and you really need to do it after you have run, since I think we need to run some code to do this.)
At present, the simplest way to do this is to make an auto-continue breakpoint at main, and attach the expr #import UIKit statement as a debugger command in that breakpoint. You'll have to do this once per new project you make, but if you're working on the same project for a while, it's not such an inconvenient workaround.