-
Notifications
You must be signed in to change notification settings - Fork 68
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
suggestion: exclude non-abap language parts from linter #3486
Comments
Example:
|
@jkadw try again, 2.113.68 published |
I've tested with standalone 2.113.68. The linter does not exclude the native SQL. You can see it from this slightly enhanced code snippet - it's still throwing an error because of the colon:
|
That last post came from another example where I put double quotes around the schema name, and as they are recognized as the beginning of a comment, the rest doesn't parse well: REPORT zfoobar.
CLASS lcl_global_func DEFINITION.
PUBLIC SECTION.
INTERFACES if_amdp_marker_hdb.
CLASS-METHODS get_dummy FOR TABLE FUNCTION /test/abc.
ENDCLASS.
CLASS lcl_global_func IMPLEMENTATION.
METHOD get_dummy BY DATABASE FUNCTION FOR HDB LANGUAGE SQLSCRIPT OPTIONS READ-ONLY.
RETURN
SELECT dummy FROM "SYS".dummy WHERE dummy = :var;
ENDMETHOD.
ENDCLASS.
|
The reason is that the linter recognizes ";" as the end of the "Native SQL" section, but this is now hidden behind the comment. If you put the ";" on a new line, it at least parses just like the original code. |
@jkadw try again, 2.113.69 published |
That's better. But the main problem is that it's still parsing the NativeSQL part as though it were ABAP. It tries to evaluate the code, and it will stumble:
In the end, this leads to the parser to be unable to recognise the "real" end of the NativeSQL part - which is defined by a semicolon, followed by whitespace and then ENDMETHOD. |
I think its getting there, #3491 will contain a few more fixes |
Looks good, I'll run it on a larger set of code when there's the next update for the vscode extension. Thanks a lot! |
I'll update the vscode extension on Friday(remind me if I forget), I'm travelling and too lazy to setup the authentication on the laptop alternatively try running it via the command line interface, to check for bugs |
new vscode extension published, it will show up in a bit |
@jkadw any luck? |
according to https://syntax.abaplint.org/#/abap/statement/MethodImplementation, a class method can be implemented using another language, e.g. SQLSCRIPT.
As the ABAP linter cannot interpret the code and throws a lot of unnecessary problem messages.
Obviously, it would be great to include these languages in the linter, but that does not seem feasible.
So I' suggest to exclude these code parts from the linter and treat them like some kind of comment.
BR, Jan
The text was updated successfully, but these errors were encountered: