Skip to content

Commit

Permalink
Update the api.ts for the getActiveFolderPath method. (#3528)
Browse files Browse the repository at this point in the history
* Update the api.ts for the getActiveFolderPath method.

This will need to also update and pull down the 1.1 version of the API.
Changes coming.

* update changelog, give credit

* update version of api class

* use major versions for enum

* update version

* match version since we are back-compat
  • Loading branch information
gcampbell-msft authored Jan 19, 2024
1 parent 566268f commit 0c3de56
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## 1.17

Features:

- Update `api.ts` to add the `getActiveFolderPath` method. [#3528](https://github.com/microsoft/vscode-cmake-tools/pull/3528) [@Kemaweyan](https://github.com/Kemaweyan)

Improvements:

- Improve when the "Configure with Debugger" popup appears and allow for "Do Not Show Again". [#3343](https://github.com/microsoft/vscode-cmake-tools/issues/3343)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3045,7 +3045,7 @@
"tslint": "^6.1.3",
"typescript": "^4.1.5",
"vsce": "^2.7.0",
"vscode-cmake-tools": "^1.0.0",
"vscode-cmake-tools": "^1.1.0",
"vscode-nls-dev": "^3.3.2",
"webpack": "^5.76.0",
"webpack-cli": "^4.5.0"
Expand Down
6 changes: 5 additions & 1 deletion src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { assertNever } from '@cmt/util';
export class CMakeToolsApiImpl implements api.CMakeToolsApi {
constructor(private readonly manager: ExtensionManager) {}

version: api.Version = api.Version.v1;
version: api.Version = api.Version.v2;

showUIElement(element: api.UIElement): Promise<void> {
return this.setUIElementVisibility(element, true);
Expand All @@ -39,6 +39,10 @@ export class CMakeToolsApiImpl implements api.CMakeToolsApi {
return project ? new CMakeProjectWrapper(project) : undefined;
}

getActiveFolderPath(): string {
return this.manager.activeFolderPath();
}

private async setUIElementVisibility(element: api.UIElement, visible: boolean): Promise<void> {
switch (element) {
case api.UIElement.StatusBarDebugButton:
Expand Down
9 changes: 8 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1967,7 +1967,14 @@ async function setup(context: vscode.ExtensionContext, progress?: ProgressHandle
vscode.commands.registerCommand('cmake.statusbar.update', () => extensionManager?.updateStatusBarForActiveProjectChange())
]);

return { getApi: (_version) => ext.api };
return { getApi: (version: api.Version) => {
// Since our API is backwards compatible, we can make our version number match that which was requested.
if (version === api.Version.v1 || version === api.Version.v2) {
ext.api.version = version;
}
return ext.api;
}
};
}

class SchemaProvider implements vscode.TextDocumentContentProvider {
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6589,10 +6589,10 @@ vsce@^2.7.0:
yauzl "^2.3.1"
yazl "^2.2.2"

vscode-cmake-tools@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/vscode-cmake-tools/-/vscode-cmake-tools-1.0.0.tgz#0321a74cd073c858c440b01602e164ecb824bd98"
integrity sha512-oZO+Ulo+OGaFuGQaPlNh+qDUWth0kmyz0d45Ws6KmqLGf1Q9gCOBct6jz7mAtzR/IqrCe/VV3O/CUmHfXpIZEA==
vscode-cmake-tools@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/vscode-cmake-tools/-/vscode-cmake-tools-1.1.0.tgz#415da0e18e7dc08500a0e748708290efdbb19485"
integrity sha512-LVOSGrY2aHZBYg0t8mbcAtoYLR+xP4FaXiUx2lNmpK6bs+mK7FA15LgGrjUvgOo34UL5av3ZuAsJ7SROKUDGug==

vscode-cpptools@^6.1.0:
version "6.1.0"
Expand Down

0 comments on commit 0c3de56

Please sign in to comment.