Skip to content

fixes signature help resolution for callexpressions#707

Merged
TwitchBronBron merged 13 commits intomasterfrom
goto-definition/improvements
Oct 7, 2022
Merged

fixes signature help resolution for callexpressions#707
TwitchBronBron merged 13 commits intomasterfrom
goto-definition/improvements

Conversation

@georgejecook
Copy link
Contributor

This pr addresses the following issues:

  • Cannot bring up signature help for nested call expressions
  • Cannot bring up signature help for multi-lined functions
  • Cannot bring up signature help for function calls with parenthesis in the arguments.

This implementation uses the new AST searchign, and parent offerings; plus some of the work done to imrpove AST fail-over when a parsing failure occurs (e.g. for presently-edited-lines, which may have invalid parenthesis/bracket pairing).

I took the approach of consolidating code that was in Program and in BrsFile, into SignatureHlepInfo, which is conceptually part of the bscPlugin.

I also added the CallExpressionInfo class, to allow us to process and store info about a call expressions' state and type, which is useful for signature resolution, and, in my next few contributions, improvements to completions, and go to definition, too.

Testing is exhaustive, having covered the types:

  • call expression
  • call func expression
  • namespaced call expression
  • class method call expression
  • class method on my own class (i.e. my m)
  • constructor call expression
  • mutliline
  • commas
  • white spaces
  • undefined/error scenarios.

However, due to having written this on program originally, then extracting to the utility classes, the tests are more integration tests in their nature.

I have also shared video of how the feature works in the IDE, which clearly demonstrates the great improvements herein.

@georgejecook
Copy link
Contributor Author

Added @triwav because I know he worked on some of this before :)

@georgejecook
Copy link
Contributor Author

note - 2 tests are failing due to sourcemap errors. reached out to @TwitchBronBron about that.

     Error: You must provide the URL of lib/mappings.wasm by calling SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) before using SourceMapConsumer
      at readWasm (/home/georgejecook/hope/open-source/vsc/brighterscript/node_modules/source-map/lib/read-wasm.js:8:13)
      at wasm (/home/georgejecook/hope/open-source/vsc/brighterscript/node_modules/source-map/lib/wasm.js:25:16)
      at /home/georgejecook/hope/open-source/vsc/brighterscript/node_modules/source-map/lib/source-map-consumer.js:264:14
      at processTicksAndRejections (node:internal/process/task_queues:95:5)
      at Context.<anonymous> (/home/georgejecook/hope/open-source/vsc/brighterscript/src/files/BrsFile.spec.ts:2507:28)

Copy link
Contributor

@triwav triwav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only gave it a quick review but looks good from what I could see. Thanks @georgejecook

Copy link
Member

@TwitchBronBron TwitchBronBron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, this looks pretty good! I went ahead and refactored the unit tests to use proper indentation and eliminate the beforeEach usage in favor of dedicated code block for each test.

Just one primary thing to address and one question and then I think this should be good to go.

@georgejecook
Copy link
Contributor Author

Overall, this looks pretty good! I went ahead and refactored the unit tests to use proper indentation and eliminate the beforeEach usage in favor of dedicated code block for each test.

That was jolly decent of you - I really appreciate your help there. T h a n k s

@TwitchBronBron TwitchBronBron merged commit 093face into master Oct 7, 2022
@TwitchBronBron TwitchBronBron deleted the goto-definition/improvements branch October 7, 2022 14:29
xgouchet added a commit to DataDog/dd-sdk-roku that referenced this pull request Nov 22, 2022
[0.60.6](rokucommunity/brighterscript@v0.60.5...0.60.6)
- 2022-11-08
 - double `super` call transpile in subclasses
([#740](rokucommunity/brighterscript#740))
 - issues with Roku doc scraper and adds missing components
([#736](rokucommunity/brighterscript#736))

[0.60.5](rokucommunity/brighterscript@v0.60.4...0.60.5)
- 2022-11-03
 - Refactor SymbolTable and AST parent logic so that SymbolTables get
their parent symbol table from its own (AstNode)
([#732](rokucommunity/brighterscript#732))
 - Significant performance boost in `validate()` by caching
`getCallableByName`
([#739](rokucommunity/brighterscript#739))
 - Add diagnostic when using namespaces as variables
([#738](rokucommunity/brighterscript#738))
 - Fix crash in `getDefinition`
([#734](rokucommunity/brighterscript#734))

[0.60.4](rokucommunity/brighterscript@v0.60.3...0.60.4)
- 2022-10-28
 - Add `name` to symbol table
([#728](rokucommunity/brighterscript#728))
 - Allow `continue` as local var
([#730](rokucommunity/brighterscript#730))
 - language server semanticToken request now waits until validate
finishes
([#727](rokucommunity/brighterscript#727))

[0.60.3](rokucommunity/brighterscript@v0.60.2...0.60.3)
- 2022-10-20
 - better parse recovery for unknown function parameter types
([#722](rokucommunity/brighterscript#722))

[0.60.2](rokucommunity/brighterscript@v0.60.1...0.60.2)
- 2022-10-18
 - if statement block var bug
([#698](rokucommunity/brighterscript#698))

[0.60.1](rokucommunity/brighterscript@v0.60.0...0.60.1)
- 2022-10-18
 - Beter location for bs1042
([#719](rokucommunity/brighterscript#719))

[0.60.0](rokucommunity/brighterscript@v0.59.0...0.60.0)
- 2022-10-10
 - goto definition for enum statements and enum members
([#715](rokucommunity/brighterscript#715))
 - nested namespace support
([#708](rokucommunity/brighterscript#708))
 - upgrade to
[[email protected]](https://github.com/rokucommunity/roku-deploy/blob/master/CHANGELOG.md#392---2022-10-03).
Notable changes since 3.9.1:
     - Replace minimatch with picomatch
([roku-deploy#101](rokucommunity/roku-deploy#101))
 - fixes signature help resolution for callexpressions
([#707](rokucommunity/brighterscript#707))
 - Fix transpilation of simple else block with leading comment
([#712](rokucommunity/brighterscript#712))
xgouchet added a commit to DataDog/dd-sdk-roku that referenced this pull request Nov 23, 2022
[0.60.6](rokucommunity/brighterscript@v0.60.5...0.60.6)
- 2022-11-08
 - double `super` call transpile in subclasses
([#740](rokucommunity/brighterscript#740))
 - issues with Roku doc scraper and adds missing components
([#736](rokucommunity/brighterscript#736))

[0.60.5](rokucommunity/brighterscript@v0.60.4...0.60.5)
- 2022-11-03
 - Refactor SymbolTable and AST parent logic so that SymbolTables get
their parent symbol table from its own (AstNode)
([#732](rokucommunity/brighterscript#732))
 - Significant performance boost in `validate()` by caching
`getCallableByName`
([#739](rokucommunity/brighterscript#739))
 - Add diagnostic when using namespaces as variables
([#738](rokucommunity/brighterscript#738))
 - Fix crash in `getDefinition`
([#734](rokucommunity/brighterscript#734))

[0.60.4](rokucommunity/brighterscript@v0.60.3...0.60.4)
- 2022-10-28
 - Add `name` to symbol table
([#728](rokucommunity/brighterscript#728))
 - Allow `continue` as local var
([#730](rokucommunity/brighterscript#730))
 - language server semanticToken request now waits until validate
finishes
([#727](rokucommunity/brighterscript#727))

[0.60.3](rokucommunity/brighterscript@v0.60.2...0.60.3)
- 2022-10-20
 - better parse recovery for unknown function parameter types
([#722](rokucommunity/brighterscript#722))

[0.60.2](rokucommunity/brighterscript@v0.60.1...0.60.2)
- 2022-10-18
 - if statement block var bug
([#698](rokucommunity/brighterscript#698))

[0.60.1](rokucommunity/brighterscript@v0.60.0...0.60.1)
- 2022-10-18
 - Beter location for bs1042
([#719](rokucommunity/brighterscript#719))

[0.60.0](rokucommunity/brighterscript@v0.59.0...0.60.0)
- 2022-10-10
 - goto definition for enum statements and enum members
([#715](rokucommunity/brighterscript#715))
 - nested namespace support
([#708](rokucommunity/brighterscript#708))
 - upgrade to
[[email protected]](https://github.com/rokucommunity/roku-deploy/blob/master/CHANGELOG.md#392---2022-10-03).
Notable changes since 3.9.1:
     - Replace minimatch with picomatch
([roku-deploy#101](rokucommunity/roku-deploy#101))
 - fixes signature help resolution for callexpressions
([#707](rokucommunity/brighterscript#707))
 - Fix transpilation of simple else block with leading comment
([#712](rokucommunity/brighterscript#712))
xgouchet added a commit to DataDog/dd-sdk-roku that referenced this pull request Nov 23, 2022
[0.60.6](rokucommunity/brighterscript@v0.60.5...0.60.6)
- 2022-11-08
 - double `super` call transpile in subclasses
([#740](rokucommunity/brighterscript#740))
 - issues with Roku doc scraper and adds missing components
([#736](rokucommunity/brighterscript#736))

[0.60.5](rokucommunity/brighterscript@v0.60.4...0.60.5)
- 2022-11-03
 - Refactor SymbolTable and AST parent logic so that SymbolTables get
their parent symbol table from its own (AstNode)
([#732](rokucommunity/brighterscript#732))
 - Significant performance boost in `validate()` by caching
`getCallableByName`
([#739](rokucommunity/brighterscript#739))
 - Add diagnostic when using namespaces as variables
([#738](rokucommunity/brighterscript#738))
 - Fix crash in `getDefinition`
([#734](rokucommunity/brighterscript#734))

[0.60.4](rokucommunity/brighterscript@v0.60.3...0.60.4)
- 2022-10-28
 - Add `name` to symbol table
([#728](rokucommunity/brighterscript#728))
 - Allow `continue` as local var
([#730](rokucommunity/brighterscript#730))
 - language server semanticToken request now waits until validate
finishes
([#727](rokucommunity/brighterscript#727))

[0.60.3](rokucommunity/brighterscript@v0.60.2...0.60.3)
- 2022-10-20
 - better parse recovery for unknown function parameter types
([#722](rokucommunity/brighterscript#722))

[0.60.2](rokucommunity/brighterscript@v0.60.1...0.60.2)
- 2022-10-18
 - if statement block var bug
([#698](rokucommunity/brighterscript#698))

[0.60.1](rokucommunity/brighterscript@v0.60.0...0.60.1)
- 2022-10-18
 - Beter location for bs1042
([#719](rokucommunity/brighterscript#719))

[0.60.0](rokucommunity/brighterscript@v0.59.0...0.60.0)
- 2022-10-10
 - goto definition for enum statements and enum members
([#715](rokucommunity/brighterscript#715))
 - nested namespace support
([#708](rokucommunity/brighterscript#708))
 - upgrade to
[[email protected]](https://github.com/rokucommunity/roku-deploy/blob/master/CHANGELOG.md#392---2022-10-03).
Notable changes since 3.9.1:
     - Replace minimatch with picomatch
([roku-deploy#101](rokucommunity/roku-deploy#101))
 - fixes signature help resolution for callexpressions
([#707](rokucommunity/brighterscript#707))
 - Fix transpilation of simple else block with leading comment
([#712](rokucommunity/brighterscript#712))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants