Using Assets from other Extensions #101
-
Hey there, I have a question about using Stuff from other extensions /Language Servers: I am writing an Extension for Sigma which is a "language" based on the yaml format. I now want to provide stuff like completion and im wondering if i could just use the YAML extension as a dependency and use functions from there. I have built a "jsonSchema" for the Sigma format. As far as i understand, YAML uses this to provide completions. I don't understand their code completely but as far as i understand, they use the language server and provide it the schema. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
I think there's two approaches you can do here:
Most likely you'll also want to list the YAML extension as an extension dependency of yours (via the |
Beta Was this translation helpful? Give feedback.
-
In your extension's const extension = vscode.extensions.getExtension('redhat.vscode-yaml');
if (extension && !extenstion.isActive) {
await extension.activate();
} |
Beta Was this translation helpful? Give feedback.
I think there's two approaches you can do here:
yaml.schemas
setting provided by the YAML extension. Admittedly, I can't find documentation about how this setting works, but based on the description it sounds like it's for associating schemas to glob file patterns. Your extension could supply a configuration default foryaml.schemas
that includes your schema and the pattern for Sigma filesMost likely you'll also want to list the YAML extension as an extension dependency of yours (via the
extensionDependencies
property in the extension manifest), u…