Skip to content

Case sensitivity for indent #115

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
machsix opened this issue Mar 10, 2019 · 5 comments
Closed

Case sensitivity for indent #115

machsix opened this issue Mar 10, 2019 · 5 comments

Comments

@machsix
Copy link
Contributor

machsix commented Mar 10, 2019

https://github.com/krvajal/vscode-fortran-support/blob/4f17f244280539ab8cc2448970c5c4b10cadd5f4/language-configuration.json#L53-L54

The current indent rule doesn't support uppercase

@pedro-ricardo
Copy link
Collaborator

Thanks for pointing that out.
Seems like we have to add a case insensitive option on those regex rules.

@pedro-ricardo
Copy link
Collaborator

Looks like it does't accept the (?i) option of Regex and I can't find a way to include de /i flag.
The stupid way to solve this is to double the words with their uppercase equivalent...

"increaseIndentPattern": "(then(\\s*|\\s*!.*)$|^\\s*(program|subroutine|function|module|do|block|associate|case|select\\s*case)\\b.*$|\\s*(else|else\\s*if|elsewhere)\\b.*$)|(THEN(\\s*|\\s*!.*)$|^\\s*(PROGRAM|SUBROUTINE|FUNCTION|MODULE|DO|BLOCK|ASSOCIATE|CASE|SELECT\\s*CASE)\\b.*$|\\s*(ELSE|ELSE\\s*IF|ELSEWHERE)\\b.*$)",
"decreaseIndentPattern": "(^\\s*end\\s*(select|if|do|function|subroutine|module|program)\\b.*$|^\\s*else|case\\b.*$)|(^\\s*END\\s*(SELECT|IF|DO|FUNCTION|SUBROUTINE|MODULE|PROGRAM)\\b.*$|^\\s*ELSE|CASE\\b.*$)"

It works but it's just wrong to do it that way. I'll keep looking.

@pedro-ricardo
Copy link
Collaborator

Got it. It has to split the enty of increaseIndentPattern into 2 {"pattern": "string", "flags": "string"}
Fixed in #117.

@machsix
Copy link
Contributor Author

machsix commented Mar 10, 2019

Thanks!

B.T.W. where did you find this stupid option? 😢 I didn't find any official documentation for the flavor of regex in vscode.

@pedro-ricardo
Copy link
Collaborator

hehehe ... Ofiicial documentation I never heard of =].
The stupid option I mentioned was just to replicate the keywords as lower and upper cases, nothing new. But that leads to a terrible maintence and it just look's like bad programing.

The option I programed, I found in some random issue of VSCode I don't recall now, but in there someone from Microsoft commented that this syntax is possible:

"increaseIndentPattern": {
            "pattern": "then(\\s*|\\s*!.*)$|^\\s*(program|subroutine|function|module|do|block|associate|case|select\\s*case)\\b.*$|\\s*(else|else\\s*if|elsewhere)\\b.*$",
            "flags": "i"
        },

That way is the correct one, now we keep the same keywords and add the case insensitive flag.
But again .... I didn't find any official documentation on the subject ^.^

@pedro-ricardo pedro-ricardo mentioned this issue Mar 16, 2019
7 tasks
@machsix machsix closed this as completed Mar 18, 2019
krvajal pushed a commit that referenced this issue Mar 26, 2019
### Check List
- [x] Merge #120 suggestion of #105
- [x] Merge #112 for fix on issue #110
- [x] Merge #117 for fix on issue #115
- [x] Merge #118 for fix on issue #116
- [x] Merge #122 for fix on issue #113
- [x] Update CHANGELOG.md
- [x] Update Package.json
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

2 participants