-
Notifications
You must be signed in to change notification settings - Fork 21
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
Show SQL cursors in outline view #216
base: main
Are you sure you want to change the base?
Conversation
Sorry, after more tests, I have some bug with fixed format. |
@sebCIL please also write some test cases for this feature. Thanks! |
Done. |
@sebCIL When running these tests, I am getting an error from a test:
|
Ok, I fixed it. |
@chrjorgensen @sebjulliand Any chance I can get your opinion on this PR? Do you think showing the cursors is standard and would be useful to the user? |
@worksofliam I have not seen cursors in an outline view before - it's not in RDi. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall a good implementation, but the EXEC
handling logic needs formatting.
Also, I don't think we should be appending the CURSOR
keyword on the definition. I think instead we should use a different SymbolKind
to indicate the difference.
See my review notes - thanks!
server/src/language/models/cache.js
Outdated
@@ -42,6 +42,10 @@ export default class Cache { | |||
|
|||
/** @type {IncludeStatement[]} */ | |||
this.includes = cache.includes || []; | |||
|
|||
/** @type {Declaration[]} */ | |||
this.cursor = cache.cursor || []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use a plural here. cursor
to be cursors
to follow the rest of the properties in this class.
server/src/language/parser.js
Outdated
indexCursorName = indexCursor-1; | ||
} | ||
if (currentCursor === undefined | ||
&& indexDeclare >=0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation here is incorrect. eslint should be able to fix this up automatically for you. (or Format Document in VS Code)
server/src/language/parser.js
Outdated
path: file, | ||
line: statementStartingLine | ||
}; | ||
currentCursor.keywords.push(`CURSOR`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cursor keyword should not be used here. See final review notes.
server/src/language/parser.js
Outdated
indexCursorName = indexCursor-1; | ||
} | ||
if (currentCursor === undefined | ||
&& indexDeclare >=0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation also incorrect here.
.map(def => DocumentSymbol.create( | ||
def.name, | ||
def.keywords.join(` `).trim(), | ||
SymbolKind.Constant, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect symbol kind. I think Operator
or Interface
@sebCIL Review incoming today. Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there are some invalid references which causes the tests to fail. Check out my comments and request my review again when it's ready.
Thanks!
p.s. I am waiting for this PR to be merged before merging a rather large cleanup PR. Thank you!
server/src/language/models/cache.js
Outdated
@@ -120,6 +127,7 @@ export default class Cache { | |||
...this.subroutines.filter(def => def.name.toUpperCase() === name), | |||
...this.variables.filter(def => def.name.toUpperCase() === name), | |||
...this.indicators.filter(def => def.name.toUpperCase() === name), | |||
...this.cursor.filter(def => def.name.toUpperCase() === name), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you've updated the cursors
property but missed renaming it elsewhere.
server/src/language/models/cache.js
Outdated
@@ -93,7 +99,8 @@ export default class Cache { | |||
this.structs.filter(d => d.position.path === fsPath).pop(), | |||
this.variables.filter(d => d.position.path === fsPath).pop(), | |||
this.constants.filter(d => d.position.path === fsPath).pop(), | |||
this.files.filter(d => d.position.path === fsPath).pop() | |||
this.files.filter(d => d.position.path === fsPath).pop(), | |||
this.cursor.filter(d => d.position.path === fsPath).pop() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect reference here also. cursor
-> cursors
server/src/language/models/cache.js
Outdated
@@ -79,6 +84,7 @@ export default class Cache { | |||
...this.subroutines.map(def => def.name), | |||
...this.variables.map(def => def.name), | |||
...this.structs.map(def => def.name), | |||
...this.cursor.map(def => def.name), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cursor
-> cursors
.
server/src/language/models/cache.js
Outdated
@@ -58,7 +62,8 @@ export default class Cache { | |||
files: [...this.files, ...second.files], | |||
structs: [...this.structs, ...second.structs], | |||
constants: [...this.constants, ...second.constants], | |||
indicators: [...this.indicators, ...second.indicators] | |||
indicators: [...this.indicators, ...second.indicators], | |||
cursor: [...this.cursor, ...second.cursor] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cursor
-> cursors
server/src/language/models/cache.js
Outdated
@@ -136,7 +144,7 @@ export default class Cache { | |||
} | |||
|
|||
clearReferences() { | |||
[...this.parameters, ...this.constants, ...this.files, ...this.procedures, ...this.subroutines, ...this.variables, ...this.structs].forEach(def => { | |||
[...this.parameters, ...this.constants, ...this.files, ...this.procedures, ...this.subroutines, ...this.variables, ...this.structs, ...this.cursor].forEach(def => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cursor
-> cursors
Sorry, I didn't test my test ! |
@sebCIL There is another big PR I am needing to merge ASAP. I suspect it will have a large impact on this PR. Just thought I'd give you a heads up. |
Changes
Show SQL cursors in outline view.
I'm not sure about the icon.
Checklist
console.log
s I added