C
C#15mo ago
Ploxi

✅ [VsCode] Control Over Suggestion Priority in YAML Files

I am using Visual Studio Code for editing YAML files with a JSON Schema. The schema provides useful suggestions, but these are often buried under the default suggestions like !AND, !BASE64, etc. I was wondering if there's a way to prioritize the JSON Schema suggestions over the default ones in YAML files.
49 Replies
Azrael
Azrael15mo ago
IntelliSense in Visual Studio Code
Learn about Visual Studio Code IntelliSense (intelligent code completion).
Ploxi
PloxiOP15mo ago
Does do nothing, have tried top,bottom...
Azrael
Azrael15mo ago
{
"[yaml]": {
"editor.snippetSuggestions": "bottom"
}
}
{
"[yaml]": {
"editor.snippetSuggestions": "bottom"
}
}
Ploxi
PloxiOP15mo ago
nothing.... added to .vscode/settings.json @Azrael
Azrael
Azrael15mo ago
You don't have to ping me. Do it per project then.
Ploxi
PloxiOP15mo ago
thats what i did
Azrael
Azrael15mo ago
Do it universally. .vscode/settings.json
Ploxi
PloxiOP15mo ago
Added it to the user settings. %APPDATA%\Code\User\settings.json no change
Azrael
Azrael15mo ago
Let me see the file.
Ploxi
PloxiOP15mo ago
Azrael
Azrael15mo ago
Put it at the absolute bottom.
Ploxi
PloxiOP15mo ago
no change :/
Azrael
Azrael15mo ago
Did you restart VSC?
Ploxi
PloxiOP15mo ago
100x
Azrael
Azrael15mo ago
Most likely an extension conflict then. Which extensions do you have? Try disabling extensions with --disable-extensions.
Ploxi
PloxiOP15mo ago
causes no suggestions being shown at all
Azrael
Azrael15mo ago
I know, you disabled IntelliSense.
Ploxi
PloxiOP15mo ago
i re enabled only redhat yaml
Azrael
Azrael15mo ago
Or wait no.
Ploxi
PloxiOP15mo ago
and the issue persists
Azrael
Azrael15mo ago
Try using a different schema.
Ploxi
PloxiOP15mo ago
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$ref": "#/definitions/ApPatch",
"definitions": {
"ApPatch": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string"
},
"version": {
"type": "string"
},
"description": {
"type": "string"
},
"author": {
"type": "string"
},
"author_email": {
"type": "string"
},
"license": {
"type": "string"
},
"Services": {
"type": "array",
"items": {
"$ref": "#/definitions/ServiceElement"
}
},
"Applications": {
"type": "array",
"items": {
"$ref": "#/definitions/Application"
}
},
"IgnoredFiles": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"Applications",
"IgnoredFiles",
"Services",
"author",
"author_email",
"description",
"license",
"name",
"version"
],
"title": "ApPatch"
},
"Application": {
"type": "object",
"additionalProperties": false,
"properties": {
"path": {
"type": "string"
},
"restartBehavior": {
"type": "string",
"enum": ["whenstarted", "always", "never"]
}
},
"required": [
"path",
"restartBehavior"
],
"title": "Application"
},
"ServiceClass": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string"
},
"description": {
"type": "string"
}
},
"required": [
"description",
"name"
],
"title": "ServiceClass"
},
"ServiceElement": {
"anyOf": [
{
"$ref": "#/definitions/ServiceClass"
},
{
"type": "string"
}
],
"title": "ServiceElement"
}
}
}
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$ref": "#/definitions/ApPatch",
"definitions": {
"ApPatch": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string"
},
"version": {
"type": "string"
},
"description": {
"type": "string"
},
"author": {
"type": "string"
},
"author_email": {
"type": "string"
},
"license": {
"type": "string"
},
"Services": {
"type": "array",
"items": {
"$ref": "#/definitions/ServiceElement"
}
},
"Applications": {
"type": "array",
"items": {
"$ref": "#/definitions/Application"
}
},
"IgnoredFiles": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"Applications",
"IgnoredFiles",
"Services",
"author",
"author_email",
"description",
"license",
"name",
"version"
],
"title": "ApPatch"
},
"Application": {
"type": "object",
"additionalProperties": false,
"properties": {
"path": {
"type": "string"
},
"restartBehavior": {
"type": "string",
"enum": ["whenstarted", "always", "never"]
}
},
"required": [
"path",
"restartBehavior"
],
"title": "Application"
},
"ServiceClass": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string"
},
"description": {
"type": "string"
}
},
"required": [
"description",
"name"
],
"title": "ServiceClass"
},
"ServiceElement": {
"anyOf": [
{
"$ref": "#/definitions/ServiceClass"
},
{
"type": "string"
}
],
"title": "ServiceElement"
}
}
}
whats wrong with this one
Azrael
Azrael15mo ago
Nothing. I just wanted to see if it worked with another one.
Ploxi
PloxiOP15mo ago
Azrael
Azrael15mo ago
Have you tried editor.quickSuggestions?
"[json]": {
"editor.snippetSuggestions": "top"
},
"[yaml]": {
"editor.snippetSuggestions": "bottom"
}
"[json]": {
"editor.snippetSuggestions": "top"
},
"[yaml]": {
"editor.snippetSuggestions": "bottom"
}
Ploxi
PloxiOP15mo ago
thats snippetSuggestions
Azrael
Azrael15mo ago
Yes. Try setting both.
Ploxi
PloxiOP15mo ago
can you try it?
Azrael
Azrael15mo ago
What?
Ploxi
PloxiOP15mo ago
if you get it to work with any schema
Azrael
Azrael15mo ago
It works with snippetSuggestions. For me that is.
Ploxi
PloxiOP15mo ago
with which schema did u try it?
Azrael
Azrael15mo ago
Default.
Ploxi
PloxiOP15mo ago
default schema?
Azrael
Azrael15mo ago
Yes.
Ploxi
PloxiOP15mo ago
it doesnt have enums or anything
Azrael
Azrael15mo ago
Let me check. Atlassian for YAML.
Ploxi
PloxiOP15mo ago
im going to install vscode on a sandbox...
Azrael
Azrael15mo ago
Default JSON.
Ploxi
PloxiOP15mo ago
ok it works WTF where does it come from
Azrael
Azrael15mo ago
Probably a bad schema. It comes from IntelliSense.
Ploxi
PloxiOP15mo ago
no I have the same schema copied over
Azrael
Azrael15mo ago
If it works using the default one then is must be an extension error.
Ploxi
PloxiOP15mo ago
to a fresh vscode insall
Ploxi
PloxiOP15mo ago
Ploxi
PloxiOP15mo ago
WHAT THE ACTUAL where does it come from nvm i dont even wanna ask thank you for bearing with me @Azrael
Azrael
Azrael15mo ago
Lol. No problem.
Ploxi
PloxiOP15mo ago
facepalm
Accord
Accord15mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server