@@ -56,6 +56,8 @@ const cssCompletion = (
5656 variables ?: Iterable < string > ,
5757) : CompletionSource => {
5858 return ( context : CompletionContext , editor : PrismEditor ) => {
59+ if ( getClosestToken ( editor , ".comment,.string" , 0 , 0 , context . pos ) ) return
60+
5961 let before = context . before
6062 let pos = context . pos
6163 let matcher = editor . extensions . matchBrackets
@@ -67,6 +69,7 @@ const cssCompletion = (
6769
6870 let colonIndex = currentStatement . lastIndexOf ( ":" )
6971 let inPropValue = colonIndex > - 1
72+ let inVar = / \b v a r \s * \( \s * $ / . test ( before . slice ( 0 , from ) )
7073
7174 let setPropCompletion = ( ) => {
7275 options = Array . from (
@@ -75,15 +78,13 @@ const cssCompletion = (
7578 inPropValue
7679 ? {
7780 label : name ,
78- insert : inPropValue ? `var(${ name } )` : name ,
81+ insert : inVar ? name : `var(${ name } )` ,
7982 }
8083 : createPropCompletion ( name ) ,
8184 )
82- options ! . push ( ...( inPropValue ? cssValues : getCSSProperties ( ) ) )
85+ if ( ! ( inPropValue && inVar ) ) options ! . push ( ...( inPropValue ? cssValues : getCSSProperties ( ) ) )
8386 }
8487
85- if ( getClosestToken ( editor , ".comment,.string" , 0 , 0 , pos ) ) return
86-
8788 if ( getClosestToken ( editor , ".tag" , 0 , 0 , pos ) ) {
8889 inPropValue = inPropValue && ! / s t y l e \s * = / . test ( currentStatement . slice ( colonIndex ) )
8990 setPropCompletion ( )
0 commit comments