Skip to content

Extending file preprocessing #277

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
wants to merge 2 commits into from
Closed

Conversation

ShatrovOA
Copy link

Hello everyone!

This request is targeting couple issues with file preprocessing:

  1. Preprocessing directive #else is not taken into consideration in case all above directives are not resolving. This issue is resolved in parse_fortran.py:2166
  2. #include statement can add something new to the AST, e.g. module usage, functions, variables, etc. In such case I would like to see definitions in a hover. To resolve this issue, I added pp_adds return value to preprocess_file and FortranFile.preprocess methods. In order to resolve all additional definitions, I added a loop over new lines in FortranFile.parse method.

Some tests were also added.
@gnikit, let me know what you think
Thanks

@ShatrovOA ShatrovOA requested a review from gnikit as a code owner May 3, 2023 21:43
@gnikit
Copy link
Member

gnikit commented May 10, 2023

Thanks for the PR @ShatrovOA I will have a look towards the end of the week.

Preliminary thoughts based on a quick look, are that the diffs in the parser are substantial.That is a problem and it will likely hold back the PR. Good comments for your additions would go a long way to make things easier to review. I will have a more detailed look during the weekend.

@codecov
Copy link

codecov bot commented May 10, 2023

Codecov Report

Merging #277 (7b421d2) into master (8918355) will increase coverage by 0.35%.
The diff coverage is 96.77%.

@@            Coverage Diff             @@
##           master     #277      +/-   ##
==========================================
+ Coverage   86.91%   87.27%   +0.35%     
==========================================
  Files          12       12              
  Lines        4556     4573      +17     
==========================================
+ Hits         3960     3991      +31     
+ Misses        596      582      -14     
Impacted Files Coverage Δ
fortls/parse_fortran.py 90.53% <96.77%> (+1.43%) ⬆️

... and 3 files with indirect coverage changes

@albertziegenhagel
Copy link
Contributor

I can at least confirm that the two lines added at parse_fortran.py:2166 fix #else preprocessing directives for me.

Copy link
Member

@gnikit gnikit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please elaborate inline and in detail as to the changes in the preprocess_file function.

The refactoring of the main parser for me is concerning.
I can't tell if there is drop of coverage in certain lines, or the base is simply out of date with the master, or there is added code (not just white space changes) and there is no 1-to-1 equivalence between the coverage of master and this PR.

Splitting changes to the parser file into multiple commits would allow for easier inspection of the changes in line by line coverage.

I will attempt to bring this PR up to date and see if there is way to add this external for-loop without causing so many diffs.

@gnikit
Copy link
Member

gnikit commented Jun 29, 2023

I can at least confirm that the two lines added at parse_fortran.py:2166 fix #else preprocessing directives for me.

Yes, I think this PR needs to be split in 2, or at least have 2 GitHub Issues linked to it. Right now this is not a mergeable PR.

@gnikit
Copy link
Member

gnikit commented Oct 13, 2023

hey @ShatrovOA I am really keen on merging the changes in this PR but we have to split them in 2 seperate PRs and have them accompanied by Issues.

Let's start with Issue 1. you mentioned. Let me know if you are interested in pursuing this, otherwise I will close this PR, and attempt to updated, cherry-pick and isolate the changes and myself.

@gnikit
Copy link
Member

gnikit commented Oct 15, 2023

I am closing this PR as it appears to have been abandoned. I will try and implement certain bits of it as a separate PR. Ideally with lazy evaluations.

@gnikit gnikit closed this Oct 15, 2023
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.

3 participants