Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ The following settings are supported:
- `yaml.style.flowMapping` : Forbids flow style mappings if set to `forbid`
- `yaml.style.flowSequence` : Forbids flow style sequences if set to `forbid`
- `yaml.keyOrdering` : Enforces alphabetical ordering of keys in mappings when set to `true`. Default is `false`
- `yaml.recommendations.show` : Recommend to install [OpenShift Toolkit](https://github.com/redhat-developer/vscode-openshift-tools) extension when detects devfile.yaml. Default is `true`
Comment thread
msivasubramaniaan marked this conversation as resolved.
Outdated

## Adding custom tags

Expand Down
10 changes: 7 additions & 3 deletions src/recommendation/openShiftToolkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ const RECOMMENDATION_MESSAGE = `The workspace has a devfile.yaml. Install [OpenS
const YAML_RECOMMENDATIONS_SHOW = 'yaml.recommendations.show';

function isDevfileYAML(uri: vscode.Uri): boolean {
if (fs.lstatSync(uri.fsPath).isDirectory()) {
const devFileYamlPath = path.join(uri.fsPath, 'devfile.yaml');
return fs.existsSync(devFileYamlPath);
try {
if (fs.lstatSync(uri.fsPath).isDirectory()) {
const devFileYamlPath = path.join(uri.fsPath, 'devfile.yaml');
return fs.existsSync(devFileYamlPath);
}
} catch (error) {
return false;
}
return !!uri.path && path.basename(uri.path).toLowerCase() === 'devfile.yaml';
}
Expand Down