-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
Adds fypp
linting support
#591
Conversation
This is the start of incorporating fypp into VS Code
Implements the following: - Spawn an async process for `fypp` to pass as output to main linter - Checks for `fypp` in the system and if not installs it - Adds safety guards to trigger only for `gfortran` - Uses cached include dirs from the main linter
@aradi is From my little local testing all should be good, but the normal preprocessor directives going into Another topic that you might be interested in discussing is substituting or adding |
No, fypp can't handle cpp-grammar. Actually, fypp does not have a proper lexer/tokenizer, it only looks for simple patterns via regular expressions. Most of the content is then passed to Python, which will parse then the expressions using its own parser. If you want to implement cpp-grammar, things get more complicated, as you would have to write a proper lexer and expression parser, so I think, it won't really profit from anything within fypp. I know that PreForM can deal with a bunch of the cpp-constructs, but not sure, whether that is of any help for you. |
For a Python based cpp you can always use https://github.com/ned14/pcpp |
Cheers @awvwgk pcpp has been on my radar for quite some time now, but I recall having some problems with it. Tbh, it might be worth just writing a C preproc from scratch. |
Addresses review comments
The linter and `fypp` include paths are quite different and should be set using different options. Direct comment from PR: """ The include paths for fypp (where fypp include files should be looked for) are typically pointing to folders in a projects source tree. While the -I options, you pass to a compiler in order to look up mod-files, are typically pointing to folders in the projects build tree. So, strictly speaking, there are completely different and should be treated differently. On the other hand, passing -I options meant for the compiler to fypp won't make any harm, as long as they do not contain source files included via #:include in any fypp-processed files. Chances for that are pretty low. """
@aradi I think at this stage I will add |
Also refactored the ordering of the settings.
feat: add basic support for
fypp
This is the start of incorporating fypp into VS Code
Hi @aradi I have gone ahead and added the simplest solution I could think off for
fypp
support to get the ball rolling and then,I thought it would be a good idea to discuss some of the functionality we would want to include and problems I/we will have to address. I will start listing listing some of the things I have already thought off:
TODO
fypp
IncludeDirs
passed to linters as--include=${}
in fyppfypp
interface to VS Code settings. For the preprocessor defines it makes sense we share them withfortls
too. Have 2 settings and merge them in the backend forfortls
or have a single option for both? I think the first one is better.fypp
auto-download with pipfypp
is enabledfypp
to workfypp
provide to make that possible.Should the preprocessor definitions fordeferred to a future conversation.fypp
andfortls
be merged?fortls
understands normal Fortran preprocessor only. (I would like to discuss swapping tofypp
if it can also handle normal preprocessor directives).Add support forTo be implemented via feat: addifort
andnagfor
if possible.fypp
linting support for Intel and NAG #615Fixes #215