Skip to content

Commit 3b00c41

Browse files
Fix mta-keywords_linker.js
1 parent 850d52c commit 3b00c41

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

web/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ pnpm-debug.log*
2121
.DS_Store
2222

2323
# tmLanguage file
24-
src/grammars/
24+
public/grammars/

web/ec.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default {
1010
{
1111
id: 'lua',
1212
scopeName: 'source.lua.mta',
13-
...JSON.parse(fs.readFileSync('./src/grammars/lua-mta.tmLanguage.json', 'utf-8')),
13+
...JSON.parse(fs.readFileSync('./public/grammars/lua-mta.tmLanguage.json', 'utf-8')),
1414
},
1515
],
1616
},

web/mta_highlighting/generate-lua-tmlanguage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const __dirname = path.dirname(__filename);
99

1010
const functionsDir = path.resolve(__dirname, '../../functions');
1111
const basePath = path.resolve(__dirname, './lua-base.tmLanguage.json');
12-
const outputPath = path.resolve(__dirname, '../src/grammars/lua-mta.tmLanguage.json');
12+
const outputPath = path.resolve(__dirname, '../public/grammars/lua-mta.tmLanguage.json');
1313

1414
const mtaKeywords = ['string','bool','boolean','number','int','float','element','player','vehicle','ped','object','building'];
1515

web/public/mta-keywords_linker.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import tmLanguage from "../src/grammars/lua-mta.tmLanguage.json";
2-
3-
function extractFunctions() {
1+
function extractFunctions(tmLanguage) {
42
const wantedScopes = new Set([
53
"support.function.mta-shared",
64
"support.function.mta-server",
@@ -16,9 +14,7 @@ function extractFunctions() {
1614
}, []) || [];
1715
}
1816

19-
const allFunctions = new Set(extractFunctions());
20-
21-
function initKeywordLinker() {
17+
function initKeywordLinker(allFunctions) {
2218
function onDomReady() {
2319
const spans = [
2420
...document.querySelectorAll(".examples-section .code-example pre code span"),
@@ -38,4 +34,8 @@ function initKeywordLinker() {
3834
: onDomReady();
3935
}
4036

41-
initKeywordLinker();
37+
fetch('/grammars/lua-mta.tmLanguage.json')
38+
.then(response => response.json())
39+
.then(tmLanguage => {
40+
initKeywordLinker(new Set(extractFunctions(tmLanguage)));
41+
});

0 commit comments

Comments
 (0)