diff --git a/CHANGES.md b/CHANGES.md index 5cd2ed0b7..542da3648 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -19,6 +19,8 @@ - Show goals on click by default, allow users to configure the behavior to follow cursor in different ways (@ejgallego, #116, fixes #89) + - Show file position in goal buffer, use collapsible elements for + goal list (@ejgallego, #115, fixes #109) # coq-lsp 0.1.0: Memory ----------------------- diff --git a/controller/coq_lsp.ml b/controller/coq_lsp.ml index 0fa9c222e..bb0605522 100644 --- a/controller/coq_lsp.ml +++ b/controller/coq_lsp.ml @@ -331,7 +331,16 @@ let do_goals ofmt ~id params = let uri, point = get_docTextPosition params in let doc = Hashtbl.find doc_table uri in let goals = Fleche.Info.LC.goals ~doc ~point goals_mode in - let result = `List (mk_goals goals) in + let result = + `Assoc + [ ( "textDocument" + , `Assoc [ ("uri", `String uri); ("version", `Int doc.version) ] ) + ; ( "position" + , `Assoc [ ("line", `Int (fst point)); ("character", `Int (snd point)) ] + ) + ; ("goals", `List (mk_goals goals)) + ] + in let msg = LSP.mk_reply ~id ~result in LIO.send_json ofmt msg diff --git a/editor/code/media/styles.css b/editor/code/media/styles.css index ddf907dc9..691842541 100644 --- a/editor/code/media/styles.css +++ b/editor/code/media/styles.css @@ -1,6 +1,6 @@ body { - font-size:medium; - /* font-size: var(--vscode-editor-font-size); */ + font-size: var(--vscode-editor-font-size); + /* font-size: medium */ font-family: var(--vscode-editor-font-family); /* font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; */ } @@ -23,4 +23,9 @@ body { .sep, hr { color : var(--vscode-editorRuler-foreground); +} + +.goalDiv { + margin-left: 0.5ex; + margin-top: 0.5ex; } \ No newline at end of file diff --git a/editor/code/src/client.ts b/editor/code/src/client.ts index 376e1bd6c..c6cff42f0 100644 --- a/editor/code/src/client.ts +++ b/editor/code/src/client.ts @@ -50,7 +50,7 @@ export function panelFactory(context: ExtensionContext) { } export function activate(context: ExtensionContext): void { - window.showInformationMessage("Going to activate!"); + window.showInformationMessage("Coq LSP Extension: Going to activate!"); function coqCommand(command: string, fn: () => void) { let disposable = commands.registerCommand("coq-lsp." + command, fn); diff --git a/editor/code/src/goals.ts b/editor/code/src/goals.ts index d67ff2bee..57919e45c 100644 --- a/editor/code/src/goals.ts +++ b/editor/code/src/goals.ts @@ -1,3 +1,4 @@ +import { basename } from "path"; import { Webview, Position, Uri, WebviewPanel } from "vscode"; import { RequestType, TextDocumentIdentifier, VersionedTextDocumentIdentifier } from "vscode-languageclient"; import { LanguageClient } from "vscode-languageclient/node"; @@ -12,44 +13,47 @@ interface Goal { } interface GoalRequest { - textDocument: TextDocumentIdentifier, - position: Position + textDocument: TextDocumentIdentifier; + position: Position; } -// returns the HTML code of goals environment -function getGoalsEnvContent(goals: Goal[]) { - if (goals.length == 0) return "No goals"; +interface GoalAnswer { + textDocument: VersionedTextDocumentIdentifier; + position: Position; + goals : Goal[]; +} - return goals - .map((curGoal, itr) => { - return ( - '
- ${codeEnvGoals} -
+