-
-
Notifications
You must be signed in to change notification settings - Fork 35
"No symbols found in document" error in VS Code v1.67 with Modern Fortran v3.0.2022042917 #460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Can you post the output of fortls --debug_filepath your_Fortran_file --debug_rootpath . --debug_symbols |
Also, please use the pre-Release version! We will be releasing version 3.0 soon, the old versions are quite outdated and problematic in all sorts of ways. |
Thanks for a prompt reply! Here is the output I tested your command with this source file:
Best, |
I followed your suggestion but, unfortunately, the issue still persists. Best, |
Did you restart VSCode after uninstalling Modern Fortran? If so could you try again with VSCode closed. Also, try setting in you settings, see if something changes if not, try the other option "Both" "fortran.provide.symbols": "fortls" |
It works, thanks for the spell! I uninstalled all extensions and installed Modern Fortran pre-release and added FYI: setting the key Best, |
That is strange, it appears that VS Code does not recognise the symbols from the Language Server. the "Both" option turns on the fallback symbols that Modern Fortran generates. Do any of the other features of |
Just checked, unfortunately, hover does not work, nor GoTo, nor Peek. |
That is indicative that your fortls installation is not being picked up by Modern Fortran. Could you point VS Code to the full path and see if that fixes anything (i.e. output of |
Please also set |
I already used the full path to fortls binary but it does not work. I tried installing fortls via pip under both conda environment (
|
I tested on Ubuntu, Windows, and macOS, only Windows and macOS that Modern Fortran & fortls function ok without issues. Outline can clearly distinguish between e.g. TYPE, SUBROUTINE, and FUNCTION, and I have hover, goto and peek, but, I'm still not able to make it work on Ubuntu. I used the same settings.json for all operating systems. Not sure if there is something wrong in Python codes of fortls that is incompatible with Ubuntu (Linux) or it is just incompatibility between fortls & VS Code that occurs only on Ubuntu? |
Okay that is good progress. That to me sounds like your Ubuntu machine is configured a bit differently, so let's try and get to the bottom of this. Can you provide the following.
|
"fortran.fortls.path": "fortls",
"fortran.linter.extraArgs": ["-ffree-form"],
"fortran.provide.symbols": "fortls",
"fortran.fortls.notifyInit": true,
"fortran.fortls.extraArgs": ["--debug_log"],
"files.associations": {
"*.F": "FortranFreeForm",
"*.f": "FortranFreeForm"
},
It seems that the --debug-log didn't produce output because VS Code couldn't load fortls. |
It seems that I have found the cause of the issue (?). I've just tested with a new folder containing a few Fortran source codes and now it works!! I guess that VS Code may need to take so long to initiate fortls on a large project (like cp2k, the one that I'm working on now). However, just curious, if it's the case, why don't I encounter the same issue on Windows and macOS as I also work on cp2k project folder? To reproduce, you may try cloning the whole cp2k project (https://github.com/cp2k/cp2k) and open the folder with your VS Code on your Ubuntu. The following is the output of Modern Fortran with
|
Latest update: it seems that the problem comes from whether a folder that is opened with VS Code contains Fortran source code or not. Here is the structure of cp2k top directory which has no any *.F source files at this level. When I open this folder with VS Code, the Modern Fortran never works.
In contrast, when I reopen with |
So VS Code extensions vscode-fortran-support/package.json Lines 46 to 99 in c2febbf
When you open a Fortran file, then Modern Fortran will activate and register all the necessary functionality including the Language Server. Language Servers in general take some time to initialize because they have to parse your entire source code into something called Abstract Syntax Trees (compilers do that in the backend too), therefore you should allow a few seconds for I hope this clears things up a bit. It would be awesome if we could make Language Servers provide results for large projects instantaneously but even the most performant Language Servers or compiler parsers need a lot of time to create AST for complex projects. |
I see. Thanks again for clarifying things. |
So everything is wroking okay? Can I close this issue now? |
Yes. Have a nice weekend! |
Hi,
I had been using VS Code with Modern Fortran & fortls without any issues till today right before I upgraded the VS Code to the latest stable release v1.67. The issue I ran into is that the VS Code could not show the outline of the codes in the outline panel (see a snapshot below). --> "No symbols found in document"
I have tried disabling all extensions, reloading the windows, restarting the program, and even downgrading to VS Code 1.66 and v1.65v, but they didn't help. I also found this #154 and it seems that the issue I have is also from the VS Code, not Fortran extensions?
Below are the details of my environment setup:
Code snippets in my setting.json file:
Any ideas to fix this issue?
The text was updated successfully, but these errors were encountered: