How does Python IntelliSense and linting in Visual Studio Code locate modules? - python-3.x

I'm just getting started using Visual Studio Code and using it to develop Python. I'm trying to understand how best to use the VS Code environment, and am trying to understand the workspace. There already is a great answer for What is a VS Code Workspace on StackOverflow.
But I have another very specific question: How are Python modules found by IntelliSense and linting in the VS Code IDE (These are provided by the VS Code Python extension as far as I can tell)? Linting is working because it can find the standard Python modules, but it cannot find the site modules. There are various places search paths can be set, both in the Python environment and in the VS Code settings. But I cannot find anything that gives a big picture view of how to set up the VS Code IDE.
I also should add that I am working with a relatively flat folder structure with application folders and common folders (with modules shared by the applications) on the same level. My thinking is to create VS Code multi-root workspaces for each application that includes the common code for each application. Do I have to set up a Python environment? Do I need to set up paths somewhere in the workspace?

Related

How do I make a MS VS C++ project standalone?

So I wrote a small script to do some math calculations, but I cant get it to run on another computer. When I try to run it, it says I'm missing multiple dlls. MSVCP140D.dll, VCRUNTIME.dll, and ucrtbased.dll are the ones it says it cant find. The only include I have in the entire doc is iostream, is it somehow linked to specific Visual Studios dlls? and if so how would I go about making it able to run on a different computer.
I am using VS 2019 and windows 10 if that helps in any way.
any and all help appreciated.
You can use static linking of the C Runtime (/MTd or /MT), but it's not recommended in general which is why all VC++ projects default to the DLL version of the CRT (/MDd or /MD).
See Microsoft Docs.

Excel add-in Shared runtime configuration, webpack.config.js is not present in project

I created an Excel Add-in project few months back using Visual Studio 2019. Now I am facing some issues and came to conclusion that Shared Runtime might not be configured correctly. So I followed this tutorial to update manifest of the project.
https://learn.microsoft.com/en-us/office/dev/add-ins/tutorials/share-data-and-events-between-custom-functions-and-the-task-pane-tutorial
However after that It is mention to update webpack.config.js, but this file is not present in project. Even if I create a new project using VS2019, this file is not there. Can anyone guide me how to add this file like its location, contents etc so that I can add it and follow next steps to configure Shared Runtime correctly.
You need to use the VSCode with yeoman generator to scaffold an add-in project which uses webpack for bundling. For example, the Build an Excel task pane add-in page contains guides for Visual Studio and Yeoman generator (as a rule VSCode or WebStorm developers).
Reply from Rick Kirkham on Github page is below.
https://github.com/OfficeDev/office-js-docs-pr/issues/3568#issuecomment-1201573455
This tutorial creates an add-in project with Yo Office. That kind of
project runs in Node.js. WebPack is a tool for bundling multiple
JavaScript files into one. WebPack is only relevant to Node.js based
projects. Since you created your project in VS 2019, your project uses
C# or VB.NET on the server side and runs in an IIS server. WebPack is
not used in that environment. That's why there is no webpack.config.js
file. Whatever problems you are having with the shared runtime, you're
not going to solve it with WebPack.
Consider raising your problem on Microsoft Q&A. Be sure to
"office-addin-dev".
Alternatively, consider recreating your project as a Node.js project.
You can use this tutorial as a good place to start.

Does Visual Studio 2022 have the same ability to open a javascript/nodejs project folder in a WSL2 Linux as VS Code is able to do?

If I'm in my WSL2 Ubuntu filesystem I can simply navigate to a javascript/nodejs folder and type code . to open that project folder and thanks to VS Code's Remote extensions, I'm essentially remoting into the Linux environment and ready to code.
Now Visual Studio 2022 has been released, I was wondering if it too supports the same level of cross-platform IDE capability as VS Code?
How, for instance, when in my WSL2 Ubuntu project in Windows Terminal, can I open my javascript/nodejs project in the Linux filesystem using VS2022, or is this not supported because VS Code is the only cross-platform IDE that can do this?
So its not really possible to do how your thinking. The problem here is that you your not understanding the difference between a "Code Editor", and an "Integrated Development Environment (IDE)", which is totally understandable, as the line that separates the two has become blurred in recent years, and also a topic of debate. There was a far more explicit distinction between the 2 10-15 years ago, however, Microsoft has done a good job at separating the two, where JetBrains will release a piece of software that can be used as an IDE, but is more often than not, used as an editor, but will still call it an IDE, even though its not an IDE in a pure sense.
How is all this related to your question?
When you open your Node.js project in VSCode via the code . command, you are opening it in an editor that implements Intelli-code, as well as a wealth of other tools, but essentially, the editor, and all the tools extract the names & file extensions of your documents, parse them (usually turning much of the info into an AST, where many extensions will make use of that info to offer the various tooling capabilities/features. The point is at the end of the day, the editor just parses all of your code, gives you info, and you make any changes as needed to your code. And again, this is what your doing with code .
With Visual Studio 2022, you can't open a project with it, unless its a project type the IDE supports, and enables the IDE, to embed its-self into your project. This includes things like built in environment, built in cache, built in build system, the files needed to bootstrap its-self. With an IDE, the IDE is part of the project.
So then why does Visual Stdio 2022 work with Node?
It works with node, to create Node.js applications within a windows environment, and it offers the ability to access different Windows SDK features via Node. These are things you could never do using server-side Linux builds with Node. When you build a Cpp application for windows, you package the entire thing in a .sin file, I haven't built a windows app in node, but I know that Node also uses the .sin file build system, which requires Visual Studio & Windows SDK to do, and parts of Visual Studio/Windows to be embedded into the project, for the project to be able to work in a Windows OS, and take advantage of MS Windows features.
Long story short, V.S. Code is the right tool for what your doing, why would Microsoft invest in two identical tools any way? If you ever want to build something for Windows, or for MS mobile device using Node, you will probably want to change your environment, to VS2022.

Get intellisense in editor from compiled code in docker containers

I've been looking a while for this but don't seem to be able to find a decent solution without creating extra mess in my workspace.
Is it possible to use an editor, such as VSCode, and make its intellisense use compiled code that resides inside a docker container (or multiple)?
One way to perhaps accomplish is this by creating shared volumes that link the node_modules and the compiled folder.
In my workspace i'm using NodeJS, Npm modules and my editor of choice is, visual studio code. The workspace setup is launched using docker-compose
Any suggestion is welcome
The VS Code Team recently announced Remote Development Extension Pack, which contains The Remote - Containers extension
The Visual Studio Code Remote - Containers extension lets you use a Docker container as a full-featured development environment. It allows you to open any folder inside (or mounted into) a container and take advantage of VS Code's full feature set.
This lets VS Code provide a local-quality development experience — including full IntelliSense (completions), code navigation, and debugging — regardless of where your tools (or code) is located.
source
Note that for now it requires the VS Code Insiders build

Get intellisense data for uncompiled projects

I inherited a project setup from a previous programmer. He used to develop for linux, but instead of coding directly in ubuntu, he shared the drives with samba and used Visual Studio to edit the files.
Now I can't compile this project in Visual Studio directly obviously, so I can't get data for intellisense and such. Would it be possible to associate symbols without compiling?
I know that what I ask seems counter intuitive, but Vim plugin OmniCPP does not come with a compiler and yet, is able to provide code completition up to a certain degree.
The commercial addin Visual Assist X can help. How well it helps is dependent upon how much information it can get from the project (if one exists): things like source files, header files and include directories. If no project is being used, you can create a dummy project just as a container to associate source and header files (not for compiling).

Resources