Recommendations on other extensions using your CMake extension #3773
-
Hey folks, I'm working on VSCode extensions. Specifically, I'm working on one for a package manager. This package manager produces environments that contain things like compilers (or CMake). These environments contain things like CMake, compilers, system libraries. I'd love to make this work nicely with CMake, and my current model is that "activating an environment" should modify the setting of where to find CMake (if it's in the environment), and provide a kit containing "the right" compilers from the environment. I think I know how to do this bluntly through modifying settings and some JSON files, but that feels hilariously dangerous (you might modify your JSON structure, and it feels like me touching your database, when I should be calling an API). Meanwhile, a scan of your exposed commands (vscode.commands.getCommands()) yields ['workbench.action.terminal.chat.makeRequest', 'workbench.view.extension.cmake-view.resetViewContainerLocation', 'workbench.view.extension.cmake-view', 'cmake.projectStatus.focus', 'cmake.projectStatus.resetViewLocation', 'cmake.outline.focus', 'cmake.outline.resetViewLocation', 'cmake.pinnedCommands.focus', 'cmake.pinnedCommands.resetViewLocation'] Twofold question:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
@DavidPoliakoff I would agree that directly modifying JSON files doesn't sound like the best idea, however there are vscode supported ways to do this that are much better. Additionally, we don't currently have an API that directly allows for updating settings. The suggested way, from my point of view, would be to use the |
Beta Was this translation helpful? Give feedback.
-
Hey @gcampbell-msft, somehow missed your (great) answer, thanks, that's exactly what I need. I'll probably do that, and similarly add CMake "Kits", and set the active kit, with a similar API. |
Beta Was this translation helpful? Give feedback.
@DavidPoliakoff I would agree that directly modifying JSON files doesn't sound like the best idea, however there are vscode supported ways to do this that are much better. Additionally, we don't currently have an API that directly allows for updating settings.
The suggested way, from my point of view, would be to use the
vscode.workspace.getConfiguration().update('cmake.cmakePath', "<newPath>")
for example. The API is here: https://code.visualstudio.com/api/references/vscode-api