Open NonSpicyBurrito opened 3 days ago
Do you know if there is an option to disable import completion for a specific library in VS Code? Does ^valibot$
only disable named imports?
Yeah autoImportSpecifierExcludeRegexes
only disables imports, and "change string
to v.string
" does not seem to be an import.
My current work around is to isolate all Valibot related code in their own modules, which is not really ideal. I have schemas in their own files, and re-export things like v.is
.
I don't have the "change string
to v.string
" problem in my VS Code. Can you share a screenshot?
In my VS Code the ordering is different:
In your case the return
is keyword autocomplete, mine is a snippet. I suppose it might be a niche use case, however this affects more than just snippets, for example it also affects autocompleting reg
to RegExp
:
Do you have any idea what we could do to improve this? Without a VS Code extension, we as a library probably have no control over the behaviour of the editor.
I'm unsure. Some ideas:
vString
instead of string
. This however would be a giant breaking change so it might be unrealistic.string
to v.string
" autocomplete comes from TS language server, so perhaps a feature request for adding exclude patterns similar to import exclude patterns.
In VS Code, when you type
string
, VS Code autocomplete suggestsimport { string } from 'valibot'
which is undesirable. This can be turned off by using^valibot$
pattern intypescript.preferences.autoImportSpecifierExcludeRegexes
.However, if you have Valibot imported like so:
When you type
string
, VS Code autocomplete suggests "changestring
tov.string
" which is also undesirable.This not only happens to
string
, but alsoobject
,date
,void
,undefined
,RegExp
(due tov.regex
),await
(due tov.awaitAsync
),return
(due tov.returns
) etc. This makes typing code likeDate.now()
viadate[tab to autocomplete to Date].now()
unusable as tab autocompletes tov.date
instead, and also makes using your own snippets for keywords unusable (for example I haveret
snippet which expands toreturn $0
).