Go to definition when opening a solution

Hi, I’m opening a solution .sln file from Visual Studio, using the extension “Open in Visual Studio Code”. With this, I cannot go to definitions, since this command in not displayed in the right-click menu. But when opening single files with the same extensions, the command on the right-click menu is visible (and doesn’t work).

Thanks!

I am not sure what that means. Are you using Visual Studio Code or Visual Studio?

Can you provide some more information and screenshots to better describe your problem.

I was able to ‘simplify’ the issue. If I open a sln file with VS Code, then te functionalities of Modern Fortran are not available. If I open a single .f file, they are available.

@leonardo_mutti ,

Welcome to the forum.

It’ll help if you provide more details and even screenshots. You mention a solution (sln) file, how was it generated? Is your son file something that is normally compatible with Microsoft’s full IDE product i.e., Microsoft Visual Studio (VS), as opposed to their editor-based product, Visual Studio Code (VSCode)?

Visual Studio Project Solution files (.sln) are not supported natively or used for configuration in VSCode. So you shouldn’t expect to configure a VSCode project using .sln files.

The Modern Fortran extension provides various configurations options (via the vscode settings menu) for individual projects have a look at the README on GitHub

2 Likes

I would just like to open a .sln file, meant for visual studio, and jump around the code using the Modern Fortran functionalities. For instance, the “Go to definition” one.

Opening the .sln file works fine. I can see the tree structure correctly. However, the “Go to definition option” is not available. Do you mean that it’s supposed to be this way, since opening visual studio .sln files with VSCode is not something that is supported?

Did you try something like File --> Add folder to workspace in a new vscode window? Unless I’m missing something this is all you need to explore the code base with Modern Fortran…

This solves the problem, although the workspace takes a lot to load, and thus, the mentioned functionalities too. Any hint on how to speed-up this process?

This discussion on Github suggests setting fortran.linter.initialize to false in the Modern Fortran extension settings.