Skip to content

Fix: support #include hover and go-to-definition in nvim#529

Open
Ayushishivhare09 wants to merge 5 commits intofortran-lang:masterfrom
Ayushishivhare09:fix/nvim-include-hover
Open

Fix: support #include hover and go-to-definition in nvim#529
Ayushishivhare09 wants to merge 5 commits intofortran-lang:masterfrom
Ayushishivhare09:fix/nvim-include-hover

Conversation

@Ayushishivhare09
Copy link
Copy Markdown

Description:
This PR adds proper support for preprocessor #include statements in fortls when using Neovim or any LSP client. Previously, #include statements were not recognized for hover or go-to-definition.

Key changes:

Added tracking for preprocessor #include statements (pp_include_statements) in FortranAST and pp_includes in FortranFile.
Resolves #include paths relative to the current file and include_dirs.
Updated langserver.py to provide go-to-definition for #include lines.
Added comprehensive tests for both normal and nested #include statements.
Minor cleanup and refactoring in debug and preprocessor code.

Testing:

Verified go-to-definition and hover for #include statements.
All existing tests pass successfully.

Impact:

Fully backward-compatible; standard Fortran INCLUDE behavior is unchanged.
Improves developer experience for projects using preprocessors.

Fixes#498

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 30, 2026

Codecov Report

❌ Patch coverage is 94.73684% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 46.91%. Comparing base (fc68d91) to head (f7e6f64).

Files with missing lines Patch % Lines
fortls/parsers/internal/parser.py 90.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #529      +/-   ##
==========================================
+ Coverage   44.43%   46.91%   +2.48%     
==========================================
  Files          35       35              
  Lines        4803     4832      +29     
==========================================
+ Hits         2134     2267     +133     
+ Misses       2669     2565     -104     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant