@@ -32,7 +32,6 @@ import { format } from '../htmlFormatter';
3232import { AttrNameCasing , getAttrNameCasing , getTagNameCasing , TagNameCasing } from '../nameCasing' ;
3333import { resolveEmbeddedCode } from '../utils' ;
3434
35- const DEPRECATED_MARKER = '**deprecated**\n\n' ;
3635const EVENT_PROP_REGEX = / ^ o n [ A - Z ] / ;
3736
3837// String constants
@@ -261,6 +260,7 @@ export function create(
261260 info . script . id ,
262261 info . root ,
263262 hint ,
263+ 'completion' ,
264264 ( ) =>
265265 baseServiceInstance . provideCompletionItems ! (
266266 document ,
@@ -345,9 +345,8 @@ export function create(
345345 addDirectiveModifiers ( htmlCompletion , item , document ) ;
346346
347347 if (
348- typeof item . documentation === 'object' && item . documentation . value . startsWith ( DEPRECATED_MARKER )
348+ typeof item . documentation === 'object' && item . documentation . value . includes ( '*@deprecated*' )
349349 ) {
350- item . documentation . value = item . documentation . value . replace ( DEPRECATED_MARKER , '' ) ;
351350 item . tags = [ 1 satisfies typeof CompletionItemTag . Deprecated ] ;
352351 }
353352
@@ -441,6 +440,7 @@ export function create(
441440 info . script . id ,
442441 info . root ,
443442 undefined ,
443+ 'hover' ,
444444 ( ) => baseServiceInstance . provideHover ! ( document , position , token ) ,
445445 ) ;
446446 const templateAst = info . root . sfc . template ?. ast ;
@@ -596,12 +596,13 @@ export function create(
596596 sourceDocumentUri : URI ,
597597 root : VueVirtualCode ,
598598 hint : 'v' | ':' | '@' | undefined ,
599+ mode : 'completion' | 'hover' ,
599600 fn : ( ) => T ,
600601 ) {
601602 // #4298: Precompute HTMLDocument before provideHtmlData to avoid parseHTMLDocument requesting component names from tsserver
602603 await fn ( ) ;
603604
604- const { sync } = await provideHtmlData ( sourceDocumentUri , root , hint ) ;
605+ const { sync } = await provideHtmlData ( sourceDocumentUri , root , hint , mode ) ;
605606 let lastSync = await sync ( ) ;
606607 let result = await fn ( ) ;
607608 while ( lastSync . version !== ( lastSync = await sync ( ) ) . version ) {
@@ -614,6 +615,7 @@ export function create(
614615 sourceDocumentUri : URI ,
615616 root : VueVirtualCode ,
616617 hint : 'v' | ':' | '@' | undefined ,
618+ mode : 'completion' | 'hover' ,
617619 ) {
618620 const [ tagNameCasing , attrNameCasing ] = await Promise . all ( [
619621 getTagNameCasing ( context , sourceDocumentUri ) ,
@@ -824,9 +826,13 @@ export function create(
824826 } ;
825827
826828 function createDescription ( meta : Pick < PropertyMeta , 'description' | 'tags' > ) {
829+ if ( mode === 'hover' ) {
830+ // dedupe from TS hover
831+ return ;
832+ }
827833 let description = meta ?. description ?? '' ;
828- if ( meta ?. tags . some ( tag => tag . name === 'deprecated' ) ) {
829- description = DEPRECATED_MARKER + description ;
834+ for ( const tag of meta . tags ) {
835+ description += `\n\n*@ ${ tag . name } * ${ tag . text ?? '' } ` ;
830836 }
831837 if ( ! description ) {
832838 return ;
0 commit comments