Skip to content

Commit

Permalink
chore: dependency check on vscode yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
Mastersam07 committed Jan 2, 2025
1 parent 5308a23 commit f3e032f
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ vsc-extension-quickstart.md
**/*.map
**/*.ts
**/.vscode-test.*
hidden/
.github/
COMMAND.md
*.vsix
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

All notable changes to this project will be documented in this file.

## [0.4.0] - 2025-01-02

### Fixed

- Failed initialization on certan ends

### Added

- Enforce `redhat.vscode-yaml` as dependency of maestro workbench

## [0.3.2] - 2025-01-02

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "A VS Code extension for Maestro YAML validation, IntelliSense, and testing.",
"publisher": "Mastersam",
"license": "MIT",
"version": "0.3.2",
"version": "0.4.0",
"icon": "assets/icon.png",
"author": {
"email": "[email protected]",
Expand All @@ -22,6 +22,9 @@
"engines": {
"vscode": "^1.61.0"
},
"extensionDependencies": [
"redhat.vscode-yaml"
],
"categories": [
"Other",
"Snippets",
Expand Down
4 changes: 3 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import * as path from "path";
import { MaestroWorkBenchTreeViewProvider } from './provider/treeView';
import { promptForRating } from './utils/rating';
import { globalState } from './state/state';
import { getFilePatterns, getOrCreateTerminal, updateYamlSchemaAssociations } from './utils/utils';
import { checkYamlExtension, getFilePatterns, getOrCreateTerminal, updateYamlSchemaAssociations } from './utils/utils';
import { watchTestFiles, discoverTests, registerTestProfiles } from './testExplorer/testExplorer';


function updateFileWatcherAndTreeView(controller: vscode.TestController, context: vscode.ExtensionContext) {
const filePatterns = getFilePatterns();

Expand All @@ -18,6 +19,7 @@ function updateFileWatcherAndTreeView(controller: vscode.TestController, context
}

export function activate(context: vscode.ExtensionContext) {
checkYamlExtension();

const controller = vscode.tests.createTestController(
'maestroWorkbenchTestProvider',
Expand Down
20 changes: 20 additions & 0 deletions src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,24 @@ export async function updateYamlSchemaAssociations(schemaPath: string) {
};

await yamlConfig.update('schemas', updatedSchemas, vscode.ConfigurationTarget.Global);
}

export function checkYamlExtension() {
const yamlExtension = vscode.extensions.getExtension('redhat.vscode-yaml');

if (!yamlExtension) {
vscode.window
.showWarningMessage('The YAML extension is not installed. Some features of Maestro Workbench may not work correctly. Would you like to install it?', 'Install', 'Cancel')
.then(selection => {
if (selection === 'Install') {
vscode.commands.executeCommand('workbench.extensions.search', 'redhat.vscode-yaml');
}
});
} else if (!yamlExtension.isActive) {
Promise.resolve(yamlExtension.activate()).then(() => {
vscode.window.showInformationMessage('YAML extension activated successfully for Maestro Workbench.');
}).catch(() => {
vscode.window.showErrorMessage('Failed to activate the YAML extension. Some features may not work correctly.');
});
}
}

0 comments on commit f3e032f

Please sign in to comment.