File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
sites/svelte-5-preview/src/lib Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -135,6 +135,28 @@ export function autocomplete(context) {
135
135
}
136
136
137
137
if ( node . name === 'VariableName' || node . name === 'PropertyName' || node . name === '.' ) {
138
+ // special case — `$inspect(...).with(...)` is the only rune that 'returns'
139
+ // an 'object' with a 'method'
140
+ if ( node . name === 'PropertyName' || node . name === '.' ) {
141
+ if (
142
+ node . parent ?. name === 'MemberExpression' &&
143
+ node . parent . firstChild ?. name === 'CallExpression' &&
144
+ node . parent . firstChild . firstChild ?. name === 'VariableName' &&
145
+ context . state . sliceDoc (
146
+ node . parent . firstChild . firstChild . from ,
147
+ node . parent . firstChild . firstChild . to
148
+ ) === '$inspect'
149
+ ) {
150
+ const open = context . matchBefore ( / \. \w * / ) ;
151
+ if ( ! open ) return null ;
152
+
153
+ return {
154
+ from : open . from ,
155
+ options : [ snippetCompletion ( '.with(${})' , { type : 'keyword' , label : '.with' } ) ]
156
+ } ;
157
+ }
158
+ }
159
+
138
160
const open = context . matchBefore ( / \$ [ \w \. ] * / ) ;
139
161
if ( ! open ) return null ;
140
162
You can’t perform that action at this time.
0 commit comments