VSCode CMake Tools disabling "Configure On Open" doesn't seem to be working - visual-studio-code

I have a workspace with several folders in it, one of which is a C++ folder with CMake stuff in it, but the others don't (they're Python or text folders). Since recently, when I open the workspace, CMake always tries and fails to configure every folder, with causes the console to open annoyingly every time, displaying messages like Cannot find CMT for folder [...] or we don't have an extension manager created yet. Setting feature set view to "full", and Unable to determine what CMake generator to use. Please install or configure a preferred generator, or update settings.json, your Kit configuration or PATH variable. Error: No usable generator found. I don't want this, I don't want CMake Tools to try to be clever and start configuring stuff without me explicitly telling it to. I've opened the settings, and unchecked the option "Cmake: Configure On Open", and unchecked the option "Cmake: Configure On Edit". I've double-checked that I've done that in all of "User", "Workspace", and "Folder" settings. However, this doesn't seem to work, still, every time I open VSCode, it tries and fails to configure, and it opens up the annoying console and displays the annoying error messages. Oh and as a bonus, it periodically displays an annoying error message box at the botton-right. How do I fix this?

Related

Should debugger be launched always in VScode when only running a file (not debugging) using code-runner?

In a VScode C/C++ programming setup on Windows 10 system, the "C/C++ Extension Pack", "Code Runner", "WSL" extensions are installed, which use Alpine Linux target on WSL on this PC. Alpine Linux WSL instance has the gcc dev environment, build-tools, gdb etc. installed, apart from the necessary VScode extensions needed inside WSL.
In this environment I am able to write C/C++ programs, build them, execute them, interact with them through the built-in terminal. I use the "Code Runner" "Run C/C++ file" shortcut button to build(if necessary) and run individual C/C++ program files (there is no Makefile and these are simple programs all thrown in a single folder, not in a project structure).
Recently however, I noticed that whenever I try to "Run C/C++ file", debugger is also launched and I get a screen like this (notice the 2 yellow/orange arrows indicating what I am trying to draw attention to):
I do not remember this being the case earlier, but I think this started after I tried to debug a program by setting a breakpoint, which I later cleared. I've also ensured that "Run > Remove All Breakpoints" is done, to make sure that there are absolutely no breakpoints. Therefore wondering if:
it is normal for debugger to get launched in this manner ?
if not, what exactly might have caused it ?
finally, what can I do to make sure that the debugger is not launched, when all I want to do is "Run" ?
In "Code Runner" settings file, I did not find anything that might control this behaviour, but then I am quite new to VScode so not sure if I am missing anything obvious.

NIOS II IDE unsuably slow

I've installed Quartus and NIOS II IDE on my Linux machine. Originally I tried importing an existing NIOS II Project into Eclipse, but it just sits there spinning away and eventually tells me it can't import the project because it already exists.
I tried installing everything on a Win10 machine and the project imported OK. I did notice that some of the paths in the orignal project have backslashes. So, for example:
#include "..\subfolder\include_file.h"
Kind of thing. I wonder whether maybe it was that was causing issues.
So, I then tried creating an hello world NIOS Processor in Quartus and making a NIOS II project from scratch. Every step along the way with Eclipse was grindingly slow, but eventually worked up until the point I was able to hit Finish at which point it's just hanging with the little circle with red and blue arrows spinning round and round.
I also have a pop up window with a long list of:
Remote System Explorer Opertion
lines, and at the top it says:
The user operation is waiting for background work to complete
It seems like everything is installed correctly, I can open the NIOS II Eclipse IDE from Quartus for example. Quartus itself works nicely.
I used these instructions to installed Eclipse:
Is anyone able to give me any pointers as to why this is so incredibly slow please? My Linux machine is pretty high spec and flies. Nothing else whatsoever even vaguely struggles on it.
If there's anything I can try to give diagnostic info, am more than happy to supply. Thanks!
I found a solution here
https://askubuntu.com/questions/761604/eclipse-not-working-in-16-04
To test if this fix works, try opening a terminal, and doing
$export SWT_GTK3=0
then run eclipse-nios2. That is, do something like
$ ~/intelFPGA_lite/20.1/nios2eds/bin/eclipse-nios2
If that fixes the problem then to make the fix permanent edit eclipse.ini which for me is in intelFPGA_lite/20.1/nios2eds/bin/eclipse_nios2
In that file, between the lines openFile and --launcher.appendVmargs
insert
--launcher.GTK_version
2
So it reads:
openFile
--launcher.GTK_version
2
--launcher.appendVmargs
and save.
Worked for me!
Try using Visual Studio Code instead. It can do (almost) everything that Eclipse can do, with the added benefit that you can debug remote. E.g. in my setup, I develop exclusively using macOS. I have Quartus installed in a Ubuntu 20.04 VM and VSCODE allows me to develop and debug as if I'm running Quartus natively in macOS.
I'll provide a rough 'how-to' below.
I strongly suggest using a Ubuntu environment for Quartus (other linux environments should work too: I've tested Arch and Manjaro). The Windows install is a royal pain to get working, regardless of IDE choice. I haven't tried the Windows version since 20.1 but nothing worked out of the box and it took many hours or messing with config files to fix it. Also, the Windows version isn't native anyway - it's actually running in Ubuntu via WSL.
Make sure you have installed your required version of Quartus - this should work for Pro, Standard and Lite editions. You can skip the manual installation of NiosII Build Tools for Eclipse if you'd like but I would actually recommend installing it. It can still be useful, if only for creating a new project, BSP etc.
Install VSCODE along with the C/C++ Extension provided by Microsoft (and the Visual Studio Code Remote - SSH extension if you intend to use that feature)
Create a new project using Eclipse (or skip, if you already have a project)
Open VSCODE, select open and navigate to the software directory of your project.
VSCODE will open your project and you should see your application directory and BSP directory.
From here, you can work on your code with full linting, auto completion etc.
If you need to regenerate your BSP, you can either do that using Eclipse or just run the command-line tool instead.
Compiling
If you allowed Eclipse to create your project for you, it will have produced a makefile in your application directory. Compiling is as simple as running 'make' from the application directory. I like to keep a terminal window open within VSCODE so I can run various tools as I work so this is usually how I can compile code. If, instead, you'd like to integrate this into VSCODE, you can define a task (https://code.visualstudio.com/docs/editor/tasks).
Eclipse automatically adds new sources that you create to the makefile. VSCODE won't do this - however, I personally don't think this is a bad thing. I don't like IDEs messing with my makefiles, I want fully control over them myself. So when you create a new source file, just remember to add it to the makefile. There is probably a way to get VSCODE to add sources files automatically (you can run commands on save etc) - but I have no motivation to try to figure this out.
Debugging
It is also possible to debug Nios2 software live on the target via the USB-Blaster using VSCODE. To do this, open the launch.json file in the .vscode folder of your project. If this file does not exist, just create it. The path should be:
<project root dir>/.vscode/launch.json
Copy the following into the launch.json file:
{
"version": "0.2.0",
"configurations": [
{
"name": "app",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/app/app.elf",
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"MIMode": "gdb",
"miDebuggerServerAddress": "localhost:2334",
"miDebuggerPath": "/PATH/TO/intelFPGA/20.1/nios2eds/bin/gnu/H-x86_64-pc-linux-gnu/bin/nios2-elf-gdb",
"debugServerPath": "/PATH/TO/intelFPGA/20.1/quartus/bin/nios2-gdb-server",
"debugServerArgs": "--tcpport 2334 --reset-target --tcppersist",
}
]
}
This file is a list of debug targets and settings. You can add any number of configurations here, but easiest to just start with one for now. The configuration above is called 'app', you can change this to suit your own project if you wish.
Update the "program" entry with the path to your applications elf
file
Update the "miDebuggerPath" path with the path the nios2-elf-gdb on
your system. This is the gdb client for Nios2
Update the "debugServerPath" path with the path the nios2-gdb-server.
This is the gdb server for Nios2
Save the file and now click on the "run and debug" button on the left
side control panel in VSCODE
You'll see play button at the top of the screen next to the configuration you just defined in launch.json. Hit the play button - this will start an instance of the gdb server, followed by the gdb client and connect the two. If all goes well, your target will run and stop in main.
VSCODE will provide you with a set of debug tools for stepping, watching variables, call stack - all that good stuff. On the right hand side, you can view the debug console which will allow you to enter commands directly into the gdb console. Note, you have to prepend your commands with -exec. E.g. to print the value of a variable x, you would type:
-exec print x
Caveat
There is a problem with this debugging method: nios2-gdb-server doesn't always exit cleanly and as a result the port doesn't close. If you try to start another debug session, the server won't start because the port is in use. Eclipse solves this problem by randomizing the port everytime it launches the gdb. I have not found a way to do that VSCODE yet.
I find easiest way around this is to run the gdb server manually when I need it. Comment out the two 'debugServer' lines above. Open a second terminal in VSCODE and run:
nios2-gdb-server --tcpport 2334 --reset-target --tcppersist
This will keep the server running even when you stop debugging. If you start another debug session, it will reconnect to the same server instance.
Update: rioV8 provided a helpful solution to this problem which involves using a vscode extension to generate a random environment variable which can used be used in place of the port numbers. The solution is here.

How Can I Always Reset My Workplace Settings for Every Time I Quit VS Code?

What I want is to have all of my workplace preferences reset every time I quit VS Code. Right now, if I quit the application and opened the same folder I previously closed, VS Code still retains all pointer positions and all opened files. This maybe good for a lot of people, but for me, I just feel overwhelmed.
What I have tried:
I tried to locate .vscode folder but it is non-existent in my project folder.
"Clear Command History" doesn't work.
"Clear Editor History" doesn't work.
Following this link ---> https://github.com/Microsoft/vscode/issues/42948 and deleting /home//.config/Code/Local Storage doesn't work.
Following this link ---> https://github.com/Microsoft/vscode/issues/42948 and running window.localStorage.clear() in Electron development console returns undefined.
I am using Ubuntu 18.04.
In the settings menu you can search for window.restoreWindows and change that to none. You can also change workbench.editor.restoreViewState to false which might also help.

Netbeans: how to undo clicking "Always run without asking"?

When running a file despite having a compiler error, I accidently marked the checkbox "Always run without asking". I regret this and would like NetBeans to ask me again before running a Java file that has compiler errors.
How can I do this? This should be simple but I cannot find any way...
As I can see from NetBeans bugzilla, this defect was left without reply: https://netbeans.org/bugzilla/show_bug.cgi?id=186776. For example, on my Windows 10 operating system I can manipulate this property using the C:\Users\<userName>\AppData\Roaming\NetBeans\8.0.1\config\Preferences\org\netbeans\modules\java\source\BuildArtifactMapperImpl.properties file, having now in it askBeforeRunWithErrors=true.

Install VSCode in a specific folder

I just downloaded the Visual Studio Code App from https://code.visualstudio.com/ and when I tried to install it, it simply just installed it by itself, without the option to change the installation path.
I have an external harddrive, which is where I want the IDE to be placed instead of the Local Harddrive. How can I change this?
On the VSCode download page select "System Installer" instead of "User Installer". The System installer will prompt you for the install location.
Full credit to Hans Passant for giving the following working solution as a comment.
The installer does very little beyond copying the files, it just creates some Explorer context menu shortcuts ("Open with Code"). Otherwise following Chromium conventions and copying itself to c:\Users\yourname\AppData\Local\Code\app-0.1.0 so it can update itself without you noticing. Boo. So high odds that simply moving that folder to the other drive works just fine, put it anywhere and create a shortcut to Code.exe. If you still want the context menu entry to work then use Regedit and search for "code\app-0.1.0".