-
Notifications
You must be signed in to change notification settings - Fork 1
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
Integrating SoftParser
: Go-to-definition code provider for SoftAST
#360
Conversation
extends IsParsedAndCompiled | ||
with IsParsed |
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.
why do we need both?
extends IsParsedAndCompiled
with IsParsed
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.
You are right 👍🏼. We don't. Removed.
/** Executes go-to-definition providers for both StrictAST and [[SoftAST]] */ | ||
def goToDefinition(settings: GoToDefSetting = testGoToDefSetting)(code: String): List[(URI, LineRange)] = { | ||
goToDefinitionStrict(settings)(code) | ||
goToDefinitionSoft(settings)(code) |
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.
both are executed, but only the results of the soft one are returned, is it expected or you miss a ++
?
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.
++
is not required. When a go-to-def test is executed on both Strict
and Soft
ASTs, they both should return the same result. Running the test already asserts this, but I'll make this explicit by checking it in this function.
// Assert that both go-to-def services (Strict & Soft) return the same result. | ||
resultSoftRanges should contain theSameElementsAs resultStrictRanges | ||
// return either one of the results because they both contain the same result | ||
resultSoft |
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.
👍
…0_provider # Conflicts: # presentation-compiler/src/main/scala/org/alephium/ralph/lsp/pc/sourcecode/SourceCodeState.scala
CodeProvider
forSoftAST
. This first version is only for handling local variables, no scoping or inheritance is handled yet.goToDefinition()
- Runs on both Strict and Soft asts.goToDefinitionSoft()
Runs only onSoftAST
because Strict AST results in parser error. Notice, the number of cases we can handle withSoftAST
have increased, showing that go-to-definitions is available even with syntax errors.SoftParser
is lazily executed. Node's parser is still the primary parser until the integration is complete.CodeProvider
execution (completion, goto definition etc) #104.