@@ -11,9 +11,8 @@ import {
1111} from 'vscode-languageserver/node'
1212import { TextDocument } from 'vscode-languageserver-textdocument'
1313import postcss from 'postcss'
14- import { properties , stories } from '@primer/primitives/dist/js/intellisense'
14+ // import {properties, stories} from '@primer/primitives/dist/js/intellisense'
1515import camelCase from 'lodash.camelcase'
16- import flatten from 'lodash.flatten'
1716import { getCurrentWord } from './utils/get-current-word'
1817import { isColor } from './utils/is-color'
1918import { getSuggestions } from './suggestions'
@@ -107,12 +106,14 @@ connection.onCompletion((params: TextDocumentPositionParams): CompletionItem[] =
107106 label : variable . name ,
108107 detail : variable . value ,
109108 // using kind only for the icon
110- kind : isColor ( variable . value )
111- ? CompletionItemKind . Color
112- : variable . type === 'functional'
113- ? CompletionItemKind . Field
114- : CompletionItemKind . Constructor ,
115- sortText : variable . sortText ,
109+ kind :
110+ typeof variable . value === 'string' && isColor ( variable . value )
111+ ? CompletionItemKind . Color
112+ : variable . type === 'functional'
113+ ? CompletionItemKind . Field
114+ : CompletionItemKind . Constructor ,
115+ // sortText: variable.sortText
116+ sortText : '---a' ,
116117 // this is slightly silly because what about multiple variables in one line
117118 // like shorthands or fallbacks
118119 insertText : currentLine . includes ( 'var' ) ? variable . name : ` var(${ variable . name } );` ,
@@ -129,17 +130,21 @@ connection.onCompletion((params: TextDocumentPositionParams): CompletionItem[] =
129130connection . onCompletionResolve ( ( item : CompletionItem ) : CompletionItem => {
130131 // experimental, could be a bad idea
131132
133+ return null
134+ // TODO: replace this with lookup from styleLint output
135+
132136 // TODO: there's a bug here when base size is open
133137 // it doesn't switch back to others
134- if ( stories [ item . label ] ) {
135- connection . sendRequest ( 'open-story' , {
136- openPanelIfClosed : false ,
137- variable : { name : item . label } ,
138- storyPath : stories [ item . label ] ,
139- } )
140- }
141138
142- return item
139+ // if (stories[item.label]) {
140+ // connection.sendRequest('open-story', {
141+ // openPanelIfClosed: false,
142+ // variable: {name: item.label},
143+ // storyPath: stories[item.label],
144+ // })
145+ // }
146+
147+ // return item
143148} )
144149
145150connection . onHover ( params => {
@@ -150,7 +155,9 @@ connection.onHover(params => {
150155 const currentWord = getCurrentWord ( doc , offset ) . slice ( 1 )
151156 if ( ! currentWord ) return null
152157
153- const currentVariable = flatten ( Object . values ( properties ) ) . find ( variable => variable . name === currentWord )
158+ const currentVariable = null
159+ // TODO: replace this with lookup from styleLint output
160+ // flatten(Object.values(properties)).find(variable => variable.name === currentWord)
154161
155162 if ( currentVariable ) {
156163 // TODO: would be nice to put docs link here as well
@@ -175,10 +182,14 @@ connection.onDefinition(params => {
175182
176183 const variableName = matches [ 0 ]
177184
178- const found = flatten ( Object . values ( properties ) ) . find ( variable => variable . name === variableName )
185+ const found = false
186+ // TODO: replace this with lookup from styleLint output
187+ // const found = flatten(Object.values(properties)).find(variable => variable.name === variableName)
179188 if ( ! found ) return
180189
181- const storyPath = stories [ found . name ]
190+ const storyPath = null
191+ // TODO: replace this with lookup from styleLint output
192+ // stories[found.name]
182193
183194 connection . sendRequest ( 'open-story' , { variable : found , storyPath} )
184195 return null
0 commit comments