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

RPGLE language needs wordPattern to include punctuation #136

Open
worksofliam opened this issue Jan 20, 2024 · 6 comments
Open

RPGLE language needs wordPattern to include punctuation #136

worksofliam opened this issue Jan 20, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@worksofliam
Copy link
Collaborator

Characters like #, $ and $ are valid in RPGLE variables and I believe this affects how the language server makes suggestions also.

@worksofliam
Copy link
Collaborator Author

@barrettotte
Copy link
Owner

barrettotte commented Feb 6, 2024

@worksofliam Sorry for the late response on this. But, am I able to just modify the sample in that link you provided?

I added this to rpgle.language-configuration.json:

"wordPattern": "(-?\\d*\\.\\d\\w*)|([^\\`\\~\\!\\%\\^\\&\\*\\(\\)\\-\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\,\\.\\<\\>\\/\\?\\s]+)"

Which just removes $ and # (@ was already not included) from the word pattern.

I tried to test by double clicking st in the following example:

**free

dcl-s @te@st@ char(16) inz(*blanks);
dcl-s #te#st# char(16) inz(*blanks);
dcl-s $te$st$ char(16) inz(*blanks);

I would have expected it to highlight the entire word, but did not:
image

I may be not understanding this issue, is there anything obvious I'm missing?

@barrettotte barrettotte added the bug Something isn't working label Feb 6, 2024
@chrjorgensen
Copy link
Collaborator

I don't know if it has any significance, but even though the three characters are valid in variable names, they are also variant characters and are not the same, if the user does not use CCSID 37 (US).

E.g. in Danish (CCSID 277) @#$ appear as ØÆÅ.

We made quite some effort in the C4i extension to ensure these characters were converted correctly when showing system names for libraries, objects and members.

The use of these characters in variable names are not recommended anymore, due to their variance. And I actually quite like that they are not considered part of the name, which indicates to the user, that they are special and should be avoided.

@worksofliam Your thoughts on this? I know they are used historically, but maybe this issue could speed up the change? 😉

@worksofliam
Copy link
Collaborator Author

@barrettotte

I would have expected it to highlight the entire word, but did not:

I would have expected that too. Not sure why it wouldn't. Maybe there is more work the language server needs to do.

@barrettotte
Copy link
Owner

@worksofliam Jeez I didn't think 4 months passed. But, anyway I think I may have solved this in
fbdd48d

I think I was misunderstanding what behavior I was supposed to be seeing. In short, I was expecting double click to highlight the whole identifier. But, what actually needed to happen is when single clicking the identifier a light highlight appears on the identifier. I think this is what you needed.

Let me know what you think and if I can close this out

@barrettotte
Copy link
Owner

Additional identifier regex for troublesome CCSIDs added by @chrjorgensen in #139

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants