Skip to content
This repository has been archived by the owner on Mar 4, 2018. It is now read-only.

Case sensitive keywords auto-completion #87

Closed
Astalaseven opened this issue Dec 21, 2014 · 10 comments
Closed

Case sensitive keywords auto-completion #87

Astalaseven opened this issue Dec 21, 2014 · 10 comments
Assignees
Milestone

Comments

@Astalaseven
Copy link
Contributor

This issue is related to issue #1.

OCI proposes to auto-complete lower variable name with upper names, for example end- suggests END-PERFORM but not end-perform.

A quick fix could be to add the lower names into the keywords in pyQode:

ALL_KEYWORDS = PSEUDO + RESERVED + NAME_CONSTANTS + FUNCTIONS
ALL_KEYWORDS += [keyword.lower() for keyword in ALL_KEYWORDS]

https://github.com/pyQode/pyqode.cobol/blob/master/pyqode/cobol/api/keywords.py#L105

@ColinDuquesnoy
Copy link
Contributor

Not sure it is related to #1. At that time the problem was that there was a mode that was converting any key pressed to upper case, meaning it was impossible to type in lower case. This was not related to auto completion.

At that time we agreed that:

a good practice is to use upper case for COBOL reserved words, and lower case for anything else.

That's why auto completion propose reserved keyworkds as UPPER CASE.

@ColinDuquesnoy
Copy link
Contributor

Instead of having both versions (upper case and lower case) as you suggest. I would prefer to have an option that let you choose your preferred convention.

@ColinDuquesnoy ColinDuquesnoy changed the title Case sensitive auto-completion Case sensitive keywords auto-completion Dec 21, 2014
@ColinDuquesnoy ColinDuquesnoy added this to the 4.3 milestone Dec 21, 2014
@ColinDuquesnoy ColinDuquesnoy self-assigned this Dec 21, 2014
@Astalaseven
Copy link
Contributor Author

In fact, what really is used is dependent on different workshops policies. The point here, it is not up to the editor to enforce anything but leave that decision to end users.

Yes, it's a convention and it should be better to let the user choose it (I don't know a lot of languages where we have to put the keywords uppercase, and I find that disturbing in my code, and problematic when you are on a mainframe/as400 where you cannot use CapsLock because it affects some commands)

@ColinDuquesnoy
Copy link
Contributor

Right. Then let's add that option.

All I have to do is to check the setting and transform any keyword to lower case here: https://github.com/pyQode/pyqode.cobol/blob/master/pyqode/cobol/backend/workers.py#L45.

ColinDuquesnoy added a commit to pyQode/pyqode.cobol that referenced this issue Dec 21, 2014
@ColinDuquesnoy
Copy link
Contributor

I added the option:

case_sensitive

Let me know if that works for you (this time, you will need to uprade all pyqode packages as well)

@Astalaseven
Copy link
Contributor Author

Yep it works, thanks!

@Astalaseven
Copy link
Contributor Author

Should it be possible to do it globally (not only the keywords)? For example, the variables:

capture du 2014-12-22 00 27 30

@ColinDuquesnoy
Copy link
Contributor

Good catch!

I think this is a bug I introduced in a recent commit where I improved the names parser (it used to respect the original case). I don't have a test for lower case variables at the moment so this bug was undetected.

@ColinDuquesnoy
Copy link
Contributor

Should be fixed now (and I added a test). You need to upgrade pyqode.cobol from source checkout.

@Astalaseven
Copy link
Contributor Author

Le 22/12/2014 13:32, Colin Duquesnoy a écrit :

Should be fixed now (and I added a test). You need to upgrade
pyqode.cobol from source checkout.


Reply to this email directly or view it on GitHub
#87 (comment).

Yep it works thank you!

@ColinDuquesnoy ColinDuquesnoy modified the milestones: 4.2.1, 4.3 Dec 29, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants