11import type { TreeViewNode } from "reactive-vscode" ;
22import type { UCDTreeItem } from "./views/ucd-explorer" ;
33import { hasUCDFolderPath } from "@luxass/unicode-utils" ;
4- import { defineExtension , executeCommand , useCommand } from "reactive-vscode" ;
5- import { Uri , window } from "vscode" ;
4+ import { defineExtension , executeCommand , useActiveTextEditor , useCommand , useEditorDecorations } from "reactive-vscode" ;
5+ import { Range , Uri , window } from "vscode" ;
66import { useUCDContentProvider } from "./composables/useUCDContentProvider" ;
77import { useUCDStore } from "./composables/useUCDStore" ;
88import * as Meta from "./generated/meta" ;
@@ -17,15 +17,23 @@ const { activate, deactivate } = defineExtension(async () => {
1717 logger . info ( `Fetched files for version 16.0.0: ${ JSON . stringify ( data , null , 2 ) } ` ) ;
1818 } ) ;
1919
20- useCommand ( Meta . commands . visualizeFile , ( ) => {
21- logger . info ( "Visualizing UCD file..." ) ;
22- } ) ;
23-
2420 useCommand ( Meta . commands . refreshExplorer , async ( ) => {
2521 logger . info ( "Refreshing UCD Explorer..." ) ;
2622 logger . info ( "UCD Explorer refreshed." ) ;
2723 } ) ;
2824
25+ useCommand ( Meta . commands . visualizeFile , ( ) => {
26+ logger . info ( "Visualizing UCD file..." ) ;
27+ // require that current editor is a UCD File
28+ const editor = useActiveTextEditor ( ) ;
29+ logger . info ( "Current active editor:" , JSON . stringify ( editor . value , null , 2 ) ) ;
30+ useEditorDecorations ( editor , {
31+ backgroundColor : "red" ,
32+ } , ( ) => [
33+ editor . value ?. visibleRanges [ 0 ] || new Range ( 0 , 0 , 20 , 20 ) ,
34+ ] ) ;
35+ } ) ;
36+
2937 useCommand ( Meta . commands . openExplorerEntry , async ( versionOrTreeView : string | TreeViewNode , filePath ?: string ) => {
3038 if ( versionOrTreeView == null ) {
3139 logger . error ( "No entry provided to openExplorerEntry command." ) ;
0 commit comments