Skip to content
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

Leave blank spaces in front of C preprocessing directives #297

Closed
fredcouderc opened this issue Jun 22, 2023 · 2 comments · Fixed by #368
Closed

Leave blank spaces in front of C preprocessing directives #297

fredcouderc opened this issue Jun 22, 2023 · 2 comments · Fixed by #368
Labels
enhancement New feature or request investigate Issue requires research to see if it can be implemented

Comments

@fredcouderc
Copy link

For the sake of code readability, I like to be able to leave blank spaces front of C preprocessing directives,

PROGRAM test

   implicit none

   #if defined USE_DOUBLE
   real(8) :: r
   #else
   real(4) :: r
   #endif

END PROGRAM

which I then process with sed directives before compilation in my makefile.

It is possible to add this possibility in regex formulas and have no error of kind: Variable "r" declared twice in scope ?

Thanks very much

@fredcouderc fredcouderc added the enhancement New feature or request label Jun 22, 2023
@gnikit
Copy link
Member

gnikit commented Jun 24, 2023

Off the top of my head it should be possible. The main complication would be if the preprocessor heuristics interfered with the main fortls functionality (which I think is the case). Currently and intentionally, these 2 are quite separate.

In general, the expectations for fortls should be that it is able to provide LSP support for valid (or soon to be valid) Fortran code.
I am afraid that any syntax outside of that like convenience modifications and vendor specific extensions fall at the bottom of the priority list.

@gnikit gnikit added the investigate Issue requires research to see if it can be implemented label Jun 24, 2023
@emanspeaks
Copy link
Contributor

I am working on a PR for a similar issue (spaces between the hash and the directive), so I'll test out adding spaces in front as well and include that in my submission

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request investigate Issue requires research to see if it can be implemented
Projects
None yet
3 participants