mirror of
https://github.com/adelphes/android-dev-ext.git
synced 2025-12-23 01:48:18 +00:00
allow configurable app root setting
This commit is contained in:
54
langserver/settings.js
Normal file
54
langserver/settings.js
Normal file
@@ -0,0 +1,54 @@
|
||||
|
||||
const defaultSettings = {
|
||||
appRoot: 'app/src/main'
|
||||
}
|
||||
|
||||
class AndroidProjectSettings {
|
||||
/**
|
||||
* The root of the app source folder.
|
||||
* This folder should contain AndroidManifest.xml as well as the asets, res, etc folders
|
||||
*/
|
||||
appRoot = defaultSettings.appRoot;
|
||||
|
||||
/**
|
||||
* The identifier for the language server settings
|
||||
*/
|
||||
ID = 'androidJavaLanguageServer';
|
||||
|
||||
static Instance = new AndroidProjectSettings();
|
||||
|
||||
/**
|
||||
* Called when the user edits the settings
|
||||
* @param {*} values
|
||||
*/
|
||||
onChange(values) {
|
||||
this.set(values);
|
||||
}
|
||||
|
||||
set(values) {
|
||||
console.log(`settings set: ${JSON.stringify(values)}`);
|
||||
for (let key in defaultSettings) {
|
||||
if (Object.prototype.hasOwnProperty.call(values, key)) {
|
||||
this[key] = values[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// function getDocumentSettings(resource) {
|
||||
// if (!hasConfigurationCapability) {
|
||||
// return Promise.resolve(projectSettings);
|
||||
// }
|
||||
// let result = documentSettings.get(resource);
|
||||
// if (!result) {
|
||||
// result = connection.workspace.getConfiguration({
|
||||
// scopeUri: resource,
|
||||
// section: 'androidJavaLanguageServer',
|
||||
// });
|
||||
// documentSettings.set(resource, result);
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
|
||||
exports.Settings = AndroidProjectSettings.Instance;
|
||||
Reference in New Issue
Block a user