Skip to content

Fix: Support directory slashes in preprocessor include regex (#481)#527

Open
dhruvch12 wants to merge 2 commits into
fortran-lang:masterfrom
dhruvch12:fix-include-regex-481
Open

Fix: Support directory slashes in preprocessor include regex (#481)#527
dhruvch12 wants to merge 2 commits into
fortran-lang:masterfrom
dhruvch12:fix-include-regex-481

Conversation

@dhruvch12
Copy link
Copy Markdown

Description

This PR resolves #481 where the PP_INCLUDE regular expression failed to capture file paths containing directory slashes, causing the language server to miss include files in subdirectories.

Changes Made

  • Updated the capture group in fortls/regex_patterns.py to [\"\w\./\\]* so it properly parses both forward (/) and backward (\) slashes in paths.
  • Added a unit test in test/test_regex_patterns.py using the exact string from the issue report (#include "petsc/finclude/petscvec.h") to ensure the regex successfully extracts the full path.

Additional Context

I am a prospective GSoC 2026 contributor and am submitting this patch as part of my application process. I am looking forward to any feedback!

@dhruvch12 dhruvch12 requested a review from gnikit as a code owner March 29, 2026 09:42
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 44.43%. Comparing base (fc68d91) to head (32da697).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #527   +/-   ##
=======================================
  Coverage   44.43%   44.43%           
=======================================
  Files          35       35           
  Lines        4803     4803           
=======================================
  Hits         2134     2134           
  Misses       2669     2669           

☔ 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.

Regex pattern for include fails to catch slash

1 participant