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

!$ syntax highlighting for Fortran module usage #17

Closed
bradenkohkz opened this issue Dec 20, 2017 · 10 comments
Closed

!$ syntax highlighting for Fortran module usage #17

bradenkohkz opened this issue Dec 20, 2017 · 10 comments

Comments

@bradenkohkz
Copy link

Hey, you guys do awesome work. like seriously being able to code fortran in VSC is amazing. I just have one suggestion. When implementing !$ it comes out as a comment, anyways to change this so that is shows the module being called?

for example:

image

I am calling the omp_lib module, but it shows up as a comment

@krvajal
Copy link
Collaborator

krvajal commented Jan 28, 2018

I don't know a better way to do this as it is, in fact, a comment in the sense of the Fortran language itself. I have to do some research on how openMP comments are highlighted by other languages.
Maybe something similar to what it actually does with #12

@krvajal krvajal changed the title !$ syntax highlighting for fortrain module usage !$ syntax highlighting for Fortran module usage Jan 28, 2018
@bradenkohkz
Copy link
Author

Yeah it is quite similiar to #27 is asking about, I will take a look into the extension code and see whether I can help, other than that. Really appreciate your work man with this extension.

@pedro-ricardo
Copy link
Collaborator

@Walkyure, can you provide us with a screenshot of this call
!$ call omp_set_num_threads(num_threads)
where it is colored properly (from another text editor I mean).

@krvajal
Copy link
Collaborator

krvajal commented May 25, 2018

Check #66

@krvajal
Copy link
Collaborator

krvajal commented May 25, 2018

This is how it will look like, the actual colors will depend on your theme
image 2018-05-26 at 1 23 49 am

@pedro-ricardo
Copy link
Collaborator

Looks great! I think you can close this.

@krvajal
Copy link
Collaborator

krvajal commented May 26, 2018

Cool, lets make the extension better.

@pedro-ricardo
Copy link
Collaborator

Last commit (#66) made all user variables on file to be highlighted. In fact every thing you type is now highlighted some how. Don't know if this was the intention... or is a collateral effect from openmp directives.

@krvajal
Copy link
Collaborator

krvajal commented May 26, 2018

The effect you are seen is mostly related to this change https://github.com/krvajal/vscode-fortran-support/pull/66/files#diff-616233c5d0603b2d6f6659138ad22463R5109.
It seems that the variables scope in the syntax is too wide and it flags everything as a variable.
The easy solution is to revert this change, the hardest one is to actually create a proper scope for var parameters and apply the highlighting there.

@pedro-ricardo
Copy link
Collaborator

Let me put it another way ... I agree with the usage of variable.parameter.fortran scope and with the attempt to standardize the scopes used.
What i don't agree is that we have a rule so general as the below one, that covers anything the user types.

"variable": {
    "name": "variable.parameter.fortran",
    "begin": "(?i)\\b(?=[a-z])",
    "end": "(?<!\\G)",

When it is not a keyword or a feature from the language it should be only in the scope source.fortran.free, like it was in the earlier versions of the extension.
In the images below i written something in a blank file ...

Here is what happens today:
new
Here is how it used to be (and what i agree with):
old

Since we have variable.parameter.fortran scope in the places that need it like in "dummy-variable" rule, for example. I think we should remove the above "variable" rule.
I've tested it and works just fine, will commit the removal to hotfix/highlight branch and you take a look.

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

No branches or pull requests

3 participants