-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: add configuration options to the extension (#132)
* fix: add missing configuration contribution * refactor: add file reference config options * chore: add settings tests * Revert "chore: add settings tests" This reverts commit 050bce9.
- Loading branch information
Showing
6 changed files
with
102 additions
and
41 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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { ConfigurationScope, workspace } from 'vscode'; | ||
|
||
/** | ||
* Determine if we should validate the config plugins within app manifests. | ||
* This uses the `expo.appManifest.pluginValidation` setting from the configuration scope. | ||
*/ | ||
export function isManifestPluginValidationEnabled(scope?: ConfigurationScope) { | ||
return workspace | ||
.getConfiguration('expo.appManifest', scope) | ||
.get<boolean>('pluginValidation', true); | ||
} | ||
|
||
/** | ||
* Determine if we should show file references auto-complete in app manifests. | ||
* This uses the `expo.appManifest.fileReferences` setting from the configuration scope. | ||
*/ | ||
export function isManifestFileReferencesEnabled(scope?: ConfigurationScope) { | ||
return workspace.getConfiguration('expo.appManifest', scope).get<boolean>('fileReferences', true); | ||
} | ||
|
||
/** | ||
* Get the manifest file references configuration set. | ||
* This uses multiple settings from the configuration scope. | ||
* - `expo.appManifest.fileReferences.showHiddenFiles` | ||
* - `expo.appManifest.fileReferences.excludeGlobPatterns` | ||
* - `expo.appManifest.fileReferences.useAbsolutePathsForFileReferences` (hidden) | ||
* - `expo.appManifest.fileReferences.mappings` (hidden) | ||
*/ | ||
export function getManifestFileReferencesConfig(scope?: ConfigurationScope) { | ||
const config = workspace.getConfiguration('expo.appManifest.fileReferences', scope); | ||
|
||
return { | ||
showHiddenFiles: config.get<boolean>('showHiddenFiles', false), | ||
filesExclude: config.get<Record<string, string> | null>('excludeGlobPatterns', null), | ||
// TODO(cedric): Check if the settings blow this comment are still required | ||
absolutePathToWorkspace: config.get<boolean>('useAbsolutePathsForFileReferences', false), | ||
mappings: config.get<Record<string, string> | null>('mappings', null), | ||
}; | ||
} |