Visual studio code vs visual studio

I am a Windows user and I use intel one api fortran with visual studio integration. Is there any advantage to using visual studio code instead of visual studio as IDE? I have seen that VSC is very popular among Fortran users but I have found it quite cumbersome to make it work in Fortran (especially to do interactive debugging). Does VSC offer extra functiinality that VS does not provide?

Any comments/feedback greatly appreciated!

I’m in exactly the same situation, and right now, the big advantage of Visual Studio vs VSCode is, as you mention, the debugging capabilities with intel compilers.

On the other side, VSCode offers the use of the Moder Fortran pluging which is wonderful to navigate through the source code with ease. Also, WSL integration in VSCode is as easy as it can get, so if you need to do cross-platform and cross-compilers compilation/verification. VSCode is your best friend. MVS2022 has an easier integration to WSL compared to the previous versions but it is still kind of cumbersome compared to VSCode.

Oh, I forgot a big one, MSV(all versions) has an annoying lag the moment you work on a file with more that 1400 lines (+/- 100). Which for some reason in C++ you don’t see… and this alone has made many people want to drop Fortran.

1 Like

@hkvzjal we have tested sample Fortran file with 1400 line and didn’t observe the lag.
Please attached the entire VS solution test case for us at Intel to test and investigate a ‘lag’ if any.

2 Likes

Hi @devorah I can’t share here the VS project as it is a proprietary closed-source project with many Gbs worth of source code … Let me correct my lack of precision: A newly generated project will respond just fine, the issue is that, as one compiles and recompiles, create new functions, the “Browse.VC.db” database gets bigger and bigger. This makes sense, but quite fast I’m obliged to destroy the database by hand or destroy and regenerate the project in order to regain fluidity when editing large files. We have not observed that with C++ having also >thousands worth lines of code.

This issue is not new:

I was working with MVS2019 until recently, now I’m testing MVS2022 17.4.5 to see if the issue has improved. If I reproduce it again I’ll create a ticket under intel’s platform.

3 Likes

The Visual Studio integrations with the Intel Fortran compiler are just terrible and have been for years. It should embarrass Intel, but they don’t seem to care. Visual Studio Code with the Modern Fortran extension is better in every possible way (and cross platform).

The only thing I use Visual Studio for now is to click the “compile” button, and to use the Intel debugger (which is great, and not available in VSCode). Otherwise, all my editing is done in VSCode.

3 Likes

Yes, all the abovementioned cases are with older, some no longer supported versions of VS.
I would like to see if VS 2022 editing experience is improved, the same or worse. I also would like to have a sample VS solution and exact steps to reproduce the slow editing issue reported here.

1 Like

Regarding the debugger, I also like the Intel debugger, is great. I tried to make a debugger work in VScode but I didn’t manage.

It would be extremely useful if someone could post a step-by-step guide on how to install VScode with a Fortran compiler (ifort or gfortran), have the modern fortran extension and a tool for setting breakpoints, etc.

I think VScode and Modern Fortran are great but in order to use them properly one has to suffer a high learning cost (and I consider myself a relatively experienced Fortran programmer). It would make sense to invest into “easing” the learning curve for Fortran users who are not computer scientists

I second that. I also tried to install debugging tools into VScode unsuccessfully.

2 Likes

I got started with this video tutorial on debugging Fortran with VScode:

It turned up to be quite straightforward, at least on Linux.

2 Likes

This is useful but it would be interesting to see how to debug using fpm instead of a Makefile. Probably not too many changes are required in the configuration.

1 Like

I usually have a build script that I call instead of make in the tasks.json. my build script does an fpm install and then in the launch.json I run the “installed” executable.

I’ll try to share an example of my setup in the next days.

4 Likes

My understanding is that using the Intel debugger on Windows in VScode is not possible. We’ve been told in the past that the debugger is sort of a hack of the Visual Studio debugger and isn’t available in any kind of standalone way for use in other IDEs. Someone please correct me if I’m wrong.

1 Like

I have just discovered an extension for Visual Studio which allows the user to open the currently open file in VS Code as well. This seems to me to be really useful especially if I ever manage to get fortls working! I have been using Visual Studio for so long that I am finding the migration to VS code quite difficult, especially at the level of project and solution management, and, as others have mentioned, debugging.

1 Like

@NormanKirkby thanks for sharing this tip! The extension of VS you refer to is available in which version of VS? I have the 2019 version

I’ve added an example of dev environment setup for a toy project I already had on GitHub here: GitHub - ludnic/command-pattern

The project itself was a very simplistic task implemented in an overly complex way (for the nature of the task) so it’s not a good example for debugging but it serves the demo purpose.

There 2 things that are nicely integrated with vscode I think: one is sharing a containerised development environment that should make reproducing software setup very straightforward. The second is what I mentioned above about the way of building with fpm and running the debugger as in the YouTube video by Lukas Lamm.

1 Like

It may not be available for VS2019. I am using v17. 7.6
“Open in Visual Studio Code” v1. 4.58 dated 26/10/2023, see also github OpenInVsCode.
Good luck
Post your experiences, other may find it useful too!

1 Like

Hey guys, I am one of the authors of the vscode extension. I would say that the changes between the 2 are numerous and so cumbersome to enumerate, so I think I will skip that for now.

What I would suggest to keep this discussion constructive is to go to our GitHub repo (GitHub - fortran-lang/vscode-fortran-support: Fortran language support for Visual Studio Code) and scroll through the existing issues and see if you have any ideas on how to improve things (feature wise). You also file new Issues features/bugs just please make sure to not spam us with duplicates or questions (questions can be posted on Discourse with the help vscode tag).

To be clear I don’t expect anyone here to contribute code to resolve any of the existing Issues, but if you really want to donate your time I would be more than glad to onboard you in the project, discuss solutions and review your code.

As I mentioned earlier this week in another post here on Discourse

There is already a half-finished Pull-Request on GitHub that would dramatically improve Python integration with Modern Fortran, especially on Windows


If you feel like helping by brainstorming please be respectful, concise, look through existing and closed Issues and provide good descriptions your requests.

2 Likes

Has anyone here tried out using Intel GDB with Visual Studio Code integration with the " Extension Pack for Intel® oneAPI Toolkits"?
https://www.intel.com/content/www/us/en/developer/tools/oneapi/distribution-for-gdb.html
https://www.intel.com/content/www/us/en/docs/oneapi-base-toolkit/get-started-guide-linux/2024-0/run-a-sample-project-with-vscode.html

Maybe this could be used together with the Modern Fortran plugin?

Yes, I have successfully under Linux (and in the past with MacOS, although not the case anymore). You just need to point in the launch.json file to the Intel GDB.

In Windows however that’s not possible, (last I checked which was a while back). The debug adaptor we inherit by the C/C++ vscode extension does not work with intel compilers.

1 Like

The issue with slow editor response reported here and on Intel Fortran Forum is fixed in the next 2024.1 Intel HPC Toolkit release.
Please note, the fix is based on the test case provided here
If your case is different from the above please submit it here and tag me. Thank you.

3 Likes