pulsar/packages/autocomplete-snippets/lib/autocomplete-snippets.js

27 lines
555 B
JavaScript
Raw Permalink Normal View History

2023-01-06 19:46:25 +03:00
module.exports = {
provider: null,
activate() {},
deactivate() {
this.provider = null
},
provide() {
if (this.provider == null) {
const SnippetsProvider = require('./snippets-provider')
this.provider = new SnippetsProvider()
if (this.snippets != null) {
this.provider.setSnippetsSource(this.snippets)
}
}
return this.provider
},
consumeSnippets(snippets) {
this.snippets = snippets
return (this.provider != null ? this.provider.setSnippetsSource(this.snippets) : undefined)
}
}