Skip to content

Conversation

@renkun-ken
Copy link
Member

@renkun-ken renkun-ken commented Aug 6, 2021

Closes #463

Hovering on the left part of a symbol might capture the symbol token with document$detect_token() while the XPath captures the token on the left of the cursor, e.g. an operator, and thus shows the workspace definition of the captured token rather than the scope definition.

This PR:

  • Ignores the operator captured by XPath.
  • Replaces all \t with a space in parse_document() to make the width of tab consistent between LSP and getParseData().
  • Improves the XPaths of hover, definition, signature, and scope completion to support code with semi-colons where nested exprlist nodes appear in the XML syntax tree.

@randy3k
Copy link
Member

randy3k commented Aug 6, 2021

Maybe adding a test for it?

if (is_rmarkdown(uri)) {
content <- purl(content)
}
# replace tab with a space since the width of a tab is 1 in LSP but 8 in getParseData().
Copy link
Member

@randy3k randy3k Aug 6, 2021

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for digging into the source!

@renkun-ken renkun-ken requested a review from randy3k August 7, 2021 02:29
@renkun-ken renkun-ken changed the title Ignore operator in hover Fix several bugs Aug 8, 2021
@renkun-ken
Copy link
Member Author

Test cases are added. Any other suggestions?

@randy3k
Copy link
Member

randy3k commented Aug 9, 2021

Thanks for working on it. LGTM.

@randy3k randy3k merged commit b2148e3 into REditorSupport:master Aug 9, 2021
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.

Bug when hovering variables

2 participants