Skip to content

feat: Add signatureHelp and hover providers to monaco#1178

Merged
mattrunyon merged 6 commits intodeephaven:mainfrom
mattrunyon:autocorrect-improvements
Mar 29, 2023
Merged

feat: Add signatureHelp and hover providers to monaco#1178
mattrunyon merged 6 commits intodeephaven:mainfrom
mattrunyon:autocorrect-improvements

Conversation

@mattrunyon
Copy link
Copy Markdown
Collaborator

@mattrunyon mattrunyon commented Mar 27, 2023

Corresponds with deephaven/deephaven-core#3607

This adds signatureHelp and hover providers if the JS API supports the corresponding requests

SignatureHelp is provided when you type a method and then type the ( character. There's also probably a keybinding in monaco to trigger it, but I'm not sure what it is.

Hover provided when you hover anything

Needs to use my core branch to test. After pulling that branch, will need to build/install the Python server using the following commands

./gradlew :py-server:assemble :py-embedded-server:assemble
pip install --force-reinstall py/server/build/wheel/deephaven_core-0.23.0-py3-none-any.whl py/embedded-server/build/wheel/deephaven_server-0.23.0-py3-none-any.whl

Then start using one of these commands. Groovy provided just to show it doesn't break anything in Groovy. There is no autocomplete in Python notebooks if you are using a Groovy worker.

./gradlew server-jetty-app:run # Python
START_OPTS="-Ddeephaven.console.type=groovy" ./gradlew server-jetty-app:run # Groovy

@mattrunyon mattrunyon requested a review from mofojed March 27, 2023 21:54
@mattrunyon mattrunyon self-assigned this Mar 27, 2023
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 27, 2023

Codecov Report

Merging #1178 (9794715) into main (362928f) will decrease coverage by 0.29%.
The diff coverage is 54.05%.

@@            Coverage Diff             @@
##             main    #1178      +/-   ##
==========================================
- Coverage   44.48%   44.19%   -0.29%     
==========================================
  Files         437      448      +11     
  Lines       32944    33424     +480     
  Branches     8304     8403      +99     
==========================================
+ Hits        14654    14771     +117     
- Misses      18241    18603     +362     
- Partials       49       50       +1     
Flag Coverage Δ
unit 44.19% <54.05%> (-0.29%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/console/src/notebook/ScriptEditor.tsx 0.00% <0.00%> (ø)
packages/console/src/monaco/MonacoProviders.tsx 54.10% <54.10%> (ø)
packages/console/src/ConsoleInput.tsx 67.69% <100.00%> (ø)

... and 52 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Comment thread packages/console/src/monaco/MonacoProviders.tsx
Comment thread packages/console/src/monaco/MonacoProviders.tsx
Comment thread packages/console/src/monaco/MonacoProviders.tsx Outdated
Comment thread packages/console/src/monaco/MonacoProviders.tsx Outdated
Comment thread packages/console/src/monaco/MonacoProviders.tsx Outdated
Comment thread packages/console/src/monaco/MonacoProviders.tsx Outdated
Comment thread packages/console/src/monaco/MonacoProviders.tsx Outdated
Comment thread packages/console/src/monaco/MonacoProviders.test.tsx
@dsmmcken
Copy link
Copy Markdown
Contributor

dsmmcken commented Mar 28, 2023

There's also probably a keybinding in monaco to trigger it, but I'm not sure what it is.

https://code.visualstudio.com/shortcuts/keyboard-shortcuts-macos.pdf

from: https://code.visualstudio.com/docs/getstarted/keybindings#_keyboard-shortcuts-reference

I wonder if it would be nice to expose these in a non-editable fashion in the settings menu or something?
microsoft/monaco-editor#823 (comment)

@mattrunyon
Copy link
Copy Markdown
Collaborator Author

I need to test this with enterprise still to ensure nothing breaks. I don't think anything will, but I might need to add back quotes in the completion item triggers. We trigger completion in db.t(", but at one point I had some weird completion items in DHC when triggered on quote. Mostly paths related to where Python was on the server

@mattrunyon mattrunyon requested a review from mofojed March 29, 2023 18:06
mofojed
mofojed previously approved these changes Mar 29, 2023
Comment thread packages/console/src/monaco/MonacoProviders.tsx
signatureHelpTriggerCharacters: ['(', ','],
}
);
if (session.getSignatureHelp) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Side note, I thought we needed strict booleans, e.g. if (session.getSigHelp != null). Would help identify cases where we just put a method name instead of calling it, e.g. if (session.getMyBoolean) vs. if(session.getMyBoolean())
Not related to this change though.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The default rules allow it because function does not have a falsy context. The rule defaults are to avoid if (str) if str is nullable since that condition covers both null and empty string

If you want to open a ticket to change it, the scenarios that are allowed by default are allowString, allowNumber, and allowNullableObject

https://typescript-eslint.io/rules/strict-boolean-expressions/#options

@mattrunyon mattrunyon merged commit f1f3abf into deephaven:main Mar 29, 2023
@mattrunyon mattrunyon deleted the autocorrect-improvements branch March 29, 2023 21:25
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants