Skip to content

Commit 92a1087

Browse files
committed
Compile keywords in the language
1 parent b92a59c commit 92a1087

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

Diff for: CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
This document lists new features, improvements, changes, and bug fixes in each release of the package.
44

5+
## GDScript mode 1.0.1 ##
6+
7+
This minor release fixes a bug with the GDScript keywords.
8+
9+
### Improvements ###
10+
11+
- Compile keywords for faster auto-completion and syntax highlighting.
12+
13+
### Bug fixes ###
14+
15+
- Fixed missing language keywords and constants lists.
16+
517
## GDScript mode 1.0.0 ##
618

719
This is the initial release of gdscript-mode, which adds support for the [Godot engine](https://godotengine.org/)'s GDScript programming language in Emacs.

Diff for: gdscript-completion.el

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
(require 'gdscript-syntax)
3636

37-
(defvar-local gdscript-completion--all-keywords (append gdscript-keywords gdscript-built-in-classes gdscript-built-in-constants gdscript-built-in-functions gdscript-built-in-types))
37+
(defvar-local gdscript-completion--all-keywords (eval-when-compile (append gdscript-keywords gdscript-built-in-classes gdscript-built-in-constants gdscript-built-in-functions gdscript-built-in-types)))
3838

3939
(defun gdscript-completion-at-point ()
4040
"This is the function to be used for the hook `completion-at-point-functions'."

Diff for: gdscript-syntax.el

+9-5
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
;;; Code:
3232

33-
(defun gdscript--get-package-file-content-as-string (file-path-relative)
33+
(defun gdscript--get-file-content-as-string (file-path-relative)
3434
"Returns the content of a file in this package as a list of
3535
strings. Used to retrieve lists of keywords for syntax
3636
highlighting.
@@ -40,7 +40,7 @@ file without the directory path. This is for compatibility with
4040
the Doom Emacs distribution, which flattens the package's
4141
structure."
4242
(with-temp-buffer
43-
(setq this-directory (file-name-directory (or load-file-name buffer-file-name)))
43+
(setq this-directory (file-name-directory "gdscript-mode.el"))
4444
(setq requested-path (concat this-directory file-path-relative))
4545
(setq file-path (if (file-readable-p requested-path)
4646
requested-path
@@ -50,12 +50,16 @@ structure."
5050
(split-string (buffer-string)
5151
"\n"
5252
t)))
53+
54+
55+
(defconst gdscript-keywords (eval-when-compile (gdscript--get-file-content-as-string "data/keywords.txt")))
56+
(defconst gdscript-built-in-constants (eval-when-compile (gdscript--get-file-content-as-string "data/built-in-constants.txt")))
5357
;; Only contains types that are not classes and that the Godot editor highlights
5458
;; like built-in keywords
55-
(defconst gdscript-built-in-types (gdscript--get-package-file-content-as-string "data/built-in-types.txt"))
56-
(defconst gdscript-built-in-functions (gdscript--get-package-file-content-as-string "data/built-in-functions.txt"))
59+
(defconst gdscript-built-in-types (eval-when-compile (gdscript--get-file-content-as-string "data/built-in-types.txt")))
60+
(defconst gdscript-built-in-functions (eval-when-compile (gdscript--get-file-content-as-string "data/built-in-functions.txt")))
5761
;; Contains all engine classes and node types, including vectors, transforms, etc.
58-
(defconst gdscript-built-in-classes (gdscript--get-package-file-content-as-string "data/built-in-classes.txt"))
62+
(defconst gdscript-built-in-classes (eval-when-compile (gdscript--get-file-content-as-string "data/built-in-classes.txt")))
5963

6064
(defun regex-maker (words)
6165
(regexp-opt words 'symbols))

0 commit comments

Comments
 (0)