C
C#11mo 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
Azrael11mo ago
IntelliSense in Visual Studio Code
Learn about Visual Studio Code IntelliSense (intelligent code completion).
Ploxi
Ploxi11mo ago
Does do nothing, have tried top,bottom...
Azrael
Azrael11mo ago
{
"[yaml]": {
"editor.snippetSuggestions": "bottom"
}
}
{
"[yaml]": {
"editor.snippetSuggestions": "bottom"
}
}
Ploxi
Ploxi11mo ago
nothing.... added to .vscode/settings.json @Azrael
Azrael
Azrael11mo ago
You don't have to ping me. Do it per project then.
Ploxi
Ploxi11mo ago
thats what i did
Azrael
Azrael11mo ago
Do it universally. .vscode/settings.json
Ploxi
Ploxi11mo ago
Added it to the user settings. %APPDATA%\Code\User\settings.json no change
Azrael
Azrael11mo ago
Let me see the file.
Ploxi
Ploxi11mo ago
Azrael
Azrael11mo ago
Put it at the absolute bottom.
Ploxi
Ploxi11mo ago
no change :/
Azrael
Azrael11mo ago
Did you restart VSC?
Ploxi
Ploxi11mo ago
100x
Azrael
Azrael11mo ago
Most likely an extension conflict then. Which extensions do you have? Try disabling extensions with --disable-extensions.
Ploxi
Ploxi11mo ago
causes no suggestions being shown at all
Azrael
Azrael11mo ago
I know, you disabled IntelliSense.
Ploxi
Ploxi11mo ago
i re enabled only redhat yaml
Azrael
Azrael11mo ago
Or wait no.
Ploxi
Ploxi11mo ago
and the issue persists
Azrael
Azrael11mo ago
Try using a different schema.
Ploxi
Ploxi11mo 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
Azrael11mo ago
Nothing. I just wanted to see if it worked with another one.
Ploxi
Ploxi11mo ago
Azrael
Azrael11mo ago
Have you tried editor.quickSuggestions?
"[json]": {
"editor.snippetSuggestions": "top"
},
"[yaml]": {
"editor.snippetSuggestions": "bottom"
}
"[json]": {
"editor.snippetSuggestions": "top"
},
"[yaml]": {
"editor.snippetSuggestions": "bottom"
}
Ploxi
Ploxi11mo ago
thats snippetSuggestions
Azrael
Azrael11mo ago
Yes. Try setting both.
Ploxi
Ploxi11mo ago
can you try it?
Azrael
Azrael11mo ago
What?
Ploxi
Ploxi11mo ago
if you get it to work with any schema
Azrael
Azrael11mo ago
It works with snippetSuggestions. For me that is.
Ploxi
Ploxi11mo ago
with which schema did u try it?
Azrael
Azrael11mo ago
Default.
Ploxi
Ploxi11mo ago
default schema?
Azrael
Azrael11mo ago
Yes.
Ploxi
Ploxi11mo ago
it doesnt have enums or anything
Azrael
Azrael11mo ago
Let me check. Atlassian for YAML.
Ploxi
Ploxi11mo ago
im going to install vscode on a sandbox...
Azrael
Azrael11mo ago
Default JSON.
Ploxi
Ploxi11mo ago
ok it works WTF where does it come from
Azrael
Azrael11mo ago
Probably a bad schema. It comes from IntelliSense.
Ploxi
Ploxi11mo ago
no I have the same schema copied over
Azrael
Azrael11mo ago
If it works using the default one then is must be an extension error.
Ploxi
Ploxi11mo ago
to a fresh vscode insall
Ploxi
Ploxi11mo ago
Ploxi
Ploxi11mo ago
WHAT THE ACTUAL where does it come from nvm i dont even wanna ask thank you for bearing with me @Azrael
Azrael
Azrael11mo ago
Lol. No problem.
Ploxi
Ploxi11mo ago
facepalm
Accord
Accord11mo 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.