Skip to content

Commit f1f3abf

Browse files
authored
feat: Add signatureHelp and hover providers to monaco (#1178)
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](https://github.com/mattrunyon/deephaven-core/tree/lsp-improvements) 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 ```
1 parent 3a11322 commit f1f3abf

10 files changed

Lines changed: 786 additions & 239 deletions

File tree

__mocks__/dh-core.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1536,6 +1536,12 @@ class IdeSession extends DeephavenObject {
15361536
getCompletionItems() {
15371537
return Promise.resolve([]);
15381538
}
1539+
getSignatureHelp() {
1540+
return Promise.resolve([]);
1541+
}
1542+
getHover() {
1543+
return Promise.resolve({});
1544+
}
15391545
closeDocument() {}
15401546

15411547
newTable(columnNames, types, data, userTimeZone) {

packages/components/scss/BaseStyleSheet.scss

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,10 +677,19 @@ input[type='number']::-webkit-inner-spin-button {
677677

678678
.monaco-editor {
679679
// Hide the "Loading..." and "No suggestions" message in the suggest widget in monaco to make it feel faster
680-
.editor-widget.suggest-widget.message {
680+
.editor-widget.suggest-widget.message,
681+
.parameter-hints-widget.message {
681682
display: none;
682683
}
683684

685+
.monaco-hover hr {
686+
margin-bottom: 4px !important; // Monaco sets this to -4 which causes items below a dividing line to collide w/ the line
687+
}
688+
689+
.parameter-hints-widget {
690+
z-index: 30 !important; // Need to make above golden-layout, but below completion item widget at z=40
691+
}
692+
684693
.find-widget {
685694
&.visible {
686695
// For some reason the height of this is set improperly in 0.18.1

packages/console/src/ConsoleInput.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
CommandHistoryStorageItem,
1515
CommandHistoryTable,
1616
} from './command-history';
17-
import { MonacoCompletionProvider, MonacoTheme, MonacoUtils } from './monaco';
17+
import { MonacoProviders, MonacoTheme, MonacoUtils } from './monaco';
1818
import './ConsoleInput.scss';
1919

2020
const log = Log.module('ConsoleInput');
@@ -513,7 +513,7 @@ export class ConsoleInput extends PureComponent<
513513
style={{ height: commandEditorHeight }}
514514
/>
515515
{model && (
516-
<MonacoCompletionProvider
516+
<MonacoProviders
517517
model={model}
518518
language={language}
519519
session={session}

packages/console/src/monaco/MonacoCompletionProvider.test.tsx

Lines changed: 0 additions & 98 deletions
This file was deleted.

packages/console/src/monaco/MonacoCompletionProvider.tsx

Lines changed: 0 additions & 134 deletions
This file was deleted.

0 commit comments

Comments
 (0)