Skip to content

Instantly share code, notes, and snippets.

@zsytssk
Created August 18, 2018 03:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zsytssk/926ad74e990926757fa3c1eb349beb76 to your computer and use it in GitHub Desktop.
Save zsytssk/926ad74e990926757fa3c1eb349beb76 to your computer and use it in GitHub Desktop.
Thenable Promise.resolve
function getDocumentSettings(resource: string): Thenable<ExampleSettings> {
if (!hasConfigurationCapability) {
return Promise.resolve(globalSettings);
}
let result = documentSettings.get(resource);
if (!result) {
result = connection.workspace.getConfiguration({
scopeUri: resource,
section: 'languageServerExample'
});
documentSettings.set(resource, result);
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment