Fixed Javascript injections for Clojure

This commit is contained in:
Maurício Szabo 2024-04-30 12:32:47 -03:00
parent 10c6eb0b0c
commit bd5d1f69ae

View File

@ -34,20 +34,17 @@ exports.activate = function() {
coverShallowerScopes: true
});
const checkFormCall = (specialFormText, node) => {
let parent = node.parent
let grandparent = parent?.parent
return grandparent?.type === 'list_lit' &&
grandparent.children[1].text === specialFormText &&
grandparent.children[2].id === parent.id
}
atom.grammars.addInjectionPoint('source.clojure', {
type: 'str_content',
language: (node) => checkFormCall('js*', node) && 'javascript',
content: notDisChild,
includeChildren: true,
languageScope: 'source.js',
coverShallowerScopes: true
type: 'list_lit',
language(node) {
if(node.children[1].text === 'js*') {
return 'javascript'
}
},
content(node) {
if(node.children[2].type === 'str_lit') {
return node.children[2].children[1];
}
},
});
}