-
Notifications
You must be signed in to change notification settings - Fork 326
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CodeEditor improvements in preparation for rendering uncommitted edits
- Auto-indent: - New line matches indentation of previous line - Backspace now deletes 4 spaces of indentation - New `Ast`-based implementation of `ensoSyntax` extension - Stylesheet-defined syntax highlighting (fixes #11475) - Vue component implementation of code editor tooltips - Removes 2nd-to-last usage of `RawAst` (#10753) - Switch to CM-compatible SourceRange so that we can use the same text algorithms for module sources and CM editor contents - Update CodeMirror dependencies
- Loading branch information
Showing
33 changed files
with
757 additions
and
617 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
app/gui/src/project-view/components/CodeEditor/CodeEditorTooltip.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<script setup lang="ts"> | ||
import { type NodeId } from '@/stores/graph' | ||
import { type GraphDb } from '@/stores/graph/graphDatabase' | ||
import { type SuggestionDbStore } from '@/stores/suggestionDatabase' | ||
import { computed } from 'vue' | ||
const { nodeId, syntax, graphDb, suggestionDbStore } = defineProps<{ | ||
nodeId: NodeId | undefined | ||
syntax: string | ||
graphDb: GraphDb | ||
suggestionDbStore: SuggestionDbStore | ||
}>() | ||
const expressionInfo = computed(() => nodeId && graphDb.getExpressionInfo(nodeId)) | ||
const typeName = computed( | ||
() => expressionInfo.value && (expressionInfo.value.typename ?? 'Unknown'), | ||
) | ||
const executionTimeMs = computed( | ||
() => | ||
expressionInfo.value?.profilingInfo[0] && | ||
(expressionInfo.value.profilingInfo[0].ExecutionTime.nanoTime / 1_000_000).toFixed(3), | ||
) | ||
const method = computed(() => expressionInfo.value?.methodCall?.methodPointer) | ||
const group = computed(() => { | ||
const id = method.value && suggestionDbStore.entries.findByMethodPointer(method.value) | ||
if (id == null) return | ||
const suggestionEntry = suggestionDbStore.entries.get(id) | ||
if (!suggestionEntry) return | ||
const groupIndex = suggestionEntry.groupIndex | ||
if (groupIndex == null) return | ||
const group = suggestionDbStore.groups[groupIndex] | ||
if (!group) return | ||
return { | ||
name: `${group.project}.${group.name}`, | ||
color: group.color, | ||
} | ||
}) | ||
</script> | ||
|
||
<template> | ||
<div v-if="nodeId">AST ID: {{ nodeId }}</div> | ||
<div v-if="typeName">Type: {{ typeName }}</div> | ||
<div v-if="executionTimeMs != null">Execution Time: {{ executionTimeMs }}ms</div> | ||
<div>Syntax: {{ syntax }}</div> | ||
<div v-if="method">Method: {{ method.module }}.{{ method.name }}</div> | ||
<div v-if="group" :style="{ color: group.color }">Group: {{ group.name }}</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.