forked from KaotoIO/vscode-kaoto
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(vscode): Provide SettingsAdapter for VSCode
This commit adds a new `getVSCodeKaotoSettings` method to the `VSCodeKaotoEditorChannelApi` class to build the Settings model. It also deprecates the existing `getCatalogURL` method as the new way to go is using the settings adapter from now on. relates: https://issues.redhat.com/browse/KTO-441 relates: KaotoIO/kaoto#1221 relates: KaotoIO/kaoto#1264
- Loading branch information
Showing
7 changed files
with
39 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,19 @@ | ||
import { KaotoEditorChannelApi } from '@kaoto/kaoto'; | ||
import { ISettingsModel, NodeLabelType, SettingsModel } from '@kaoto/kaoto/models'; | ||
import { DefaultVsCodeKieEditorChannelApiImpl } from '@kie-tools-core/vscode-extension/dist/DefaultVsCodeKieEditorChannelApiImpl'; | ||
import * as vscode from 'vscode'; | ||
|
||
export class VSCodeKaotoEditorChannelApi extends DefaultVsCodeKieEditorChannelApiImpl { | ||
async getCatalogURL(): Promise<string | undefined> { | ||
return await vscode.workspace.getConfiguration('kaoto').get('catalog.url'); | ||
} | ||
export class VSCodeKaotoEditorChannelApi extends DefaultVsCodeKieEditorChannelApiImpl implements KaotoEditorChannelApi { | ||
async getCatalogURL(): Promise<string | undefined> { | ||
return await vscode.workspace.getConfiguration('kaoto').get('catalog.url'); | ||
} | ||
|
||
async getVSCodeKaotoSettings(): Promise<ISettingsModel> { | ||
const settingsModel: ISettingsModel = { | ||
catalogUrl: vscode.workspace.getConfiguration('kaoto').get<string | null>('catalog.url') ?? '', | ||
nodeLabel: NodeLabelType.Description, | ||
}; | ||
|
||
return new SettingsModel(settingsModel); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters