allow configurable app root setting

This commit is contained in:
Dave Holoway
2020-06-28 19:23:39 +01:00
parent 113a7379ed
commit 18049ea08c
2 changed files with 156 additions and 108 deletions

54
langserver/settings.js Normal file
View 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;