This repository was archived by the owner on Sep 19, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +33
-2
lines changed
Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,16 @@ increment('not a number');`,
6262 } ) ;
6363} ) ( ) ;
6464
65+ function renderDisplayParts ( dp : ts . SymbolDisplayPart [ ] ) {
66+ const div = document . createElement ( "div" ) ;
67+ for ( const part of dp ) {
68+ const span = div . appendChild ( document . createElement ( "span" ) ) ;
69+ span . className = `quick-info-${ part . kind } ` ;
70+ span . innerText = part . text ;
71+ }
72+ return div ;
73+ }
74+
6575( async ( ) => {
6676 const path = "index.ts" ;
6777
@@ -90,7 +100,28 @@ increment('not a number');`,
90100 tsSyncWorker ( ) ,
91101 tsLinterWorker ( ) ,
92102 autocompletion ( {
93- override : [ tsAutocompleteWorker ( ) ] ,
103+ override : [
104+ tsAutocompleteWorker ( {
105+ renderAutocomplete ( raw ) {
106+ return ( ) => {
107+ const div = document . createElement ( "div" ) ;
108+ if ( raw . documentation ) {
109+ const description = div . appendChild (
110+ document . createElement ( "div" ) ,
111+ ) ;
112+ description . appendChild (
113+ renderDisplayParts ( raw . documentation ) ,
114+ ) ;
115+ }
116+ if ( raw ?. displayParts ) {
117+ const dp = div . appendChild ( document . createElement ( "div" ) ) ;
118+ dp . appendChild ( renderDisplayParts ( raw . displayParts ) ) ;
119+ }
120+ return { dom : div } ;
121+ } ;
122+ } ,
123+ } ) ,
124+ ] ,
94125 } ) ,
95126 tsHoverWorker ( ) ,
96127 ] ,
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import { AutocompleteOptions } from "./types.js";
1212 * the TypeScript environment in a web worker.
1313 */
1414export function tsAutocompleteWorker (
15- opts : AutocompleteOptions ,
15+ opts : AutocompleteOptions = { } ,
1616) : CompletionSource {
1717 return async (
1818 context : CompletionContext ,
You can’t perform that action at this time.
0 commit comments