Skip to content

Linter can't find mod files in the current directory #86

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

Closed
certik opened this issue Jul 17, 2018 · 6 comments
Closed

Linter can't find mod files in the current directory #86

certik opened this issue Jul 17, 2018 · 6 comments

Comments

@certik
Copy link
Member

certik commented Jul 17, 2018

First of all, thank you for creating and maintaining this extension.

I have to explicitly include directories with my mod files in settings.json, in my case like this:

    "fortran.includePaths": [
        "/home/certik/repos/hfsolver/src",
    ],

But my project has many subdirectories etc. I use cmake to manage it. Is there some better way to specify the paths for the linter? If not, is the intended usage that I will simply list all directories where one can find the .mod files my project specific settings for vscode?

Also, my project can be build both in tree and out of tree using cmake. In the out of tree build, the mod files will be at different location. Is there a solution to that?

Thanks for any tips.

@krvajal
Copy link
Collaborator

krvajal commented Oct 14, 2018

Hello, that's an interesting problem and I will definitively look into it.

@krvajal krvajal self-assigned this Oct 14, 2018
@krvajal
Copy link
Collaborator

krvajal commented Oct 14, 2018

I think one possible solution, besides the obvious of adding each directory entry, is to allow you to use glob expressions when specifying the includePaths. For example, given the following filesystem structure

projectRoot/
├── src
    ├── utils
	├── modules
    	├── module_a
    	├── module_b

and the following config

"includePath": ["src/**/"] 

the extension will add to the search path the following directories

<projectRoot>/src/
<projectRoot>/src/utils
<projectRoot>/src/modules
<projectRoot>/src/modules/module_a
<projectRoot>/src/modules/module_b

Is that good enough to solve your use case or I am getting something wrong?

@krvajal
Copy link
Collaborator

krvajal commented Oct 14, 2018

^ @certik

@redbluee
Copy link

redbluee commented Oct 30, 2019

I think one possible solution, besides the obvious of adding each directory entry, is to allow you to use glob expressions when specifying the includePaths. For example, given the following filesystem structure

projectRoot/
├── src
    ├── utils
	├── modules
    	├── module_a
    	├── module_b

and the following config

"includePath": ["src/**/"] 

the extension will add to the search path the following directories

<projectRoot>/src/
<projectRoot>/src/utils
<projectRoot>/src/modules
<projectRoot>/src/modules/module_a
<projectRoot>/src/modules/module_b

Is that good enough to solve your use case or I am getting something wrong?

I ran into the same problem, a year later. I found myself for each of my subdirectories adding its location to "fortran.includePaths".
From my side, recursively searching in includePaths would be a nice-to-have.
Btw @krvajal , I think you meant that kind of dir tree

projectRoot/
├── src
    ├── utils
    ├── modules
    	├── module_a
    	├── module_b

for adding the search paths you,ve mentioned before.

@pedro-ricardo
Copy link
Collaborator

pedro-ricardo commented Feb 28, 2020

recursively searching in includePaths would be a nice-to-have.

Issues #159 and #132 also request the include folders to support relative paths

@gnikit gnikit pinned this issue Oct 3, 2021
@gnikit gnikit linked a pull request Oct 3, 2021 that will close this issue
@gnikit gnikit unpinned this issue Oct 3, 2021
@gnikit gnikit self-assigned this Nov 12, 2021
@gnikit
Copy link
Member

gnikit commented Nov 17, 2021

@certik took me some time to get back to this but currently we don't have native support with CMake. At some point I will have to add it but I am slightly short on time right now.

With regards to the question at hand, I have gone ahead and pushed v2.6.1 on the VS marketplace which adds variable interpolation and glob support so you could pass an include directory like the one mentioned above src/** or ${workspaceFolder}/include/**. Just be careful not to pass too broad of a glob pattern for a very nested directory because gfortran has a limit to the number of arguments it can have when compiling

@gnikit gnikit closed this as completed Nov 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants