1 Commits

Author SHA1 Message Date
Nathan Lovato
92a1087a30 Compile keywords in the language 2020-02-16 07:32:50 -06:00
3 changed files with 22 additions and 6 deletions

View File

@@ -2,6 +2,18 @@
This document lists new features, improvements, changes, and bug fixes in each release of the package. This document lists new features, improvements, changes, and bug fixes in each release of the package.
## GDScript mode 1.0.1 ##
This minor release fixes a bug with the GDScript keywords.
### Improvements ###
- Compile keywords for faster auto-completion and syntax highlighting.
### Bug fixes ###
- Fixed missing language keywords and constants lists.
## GDScript mode 1.0.0 ## ## GDScript mode 1.0.0 ##
This is the initial release of gdscript-mode, which adds support for the [Godot engine](https://godotengine.org/)'s GDScript programming language in Emacs. This is the initial release of gdscript-mode, which adds support for the [Godot engine](https://godotengine.org/)'s GDScript programming language in Emacs.

View File

@@ -34,7 +34,7 @@
(require 'gdscript-syntax) (require 'gdscript-syntax)
(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)) (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)))
(defun gdscript-completion-at-point () (defun gdscript-completion-at-point ()
"This is the function to be used for the hook `completion-at-point-functions'." "This is the function to be used for the hook `completion-at-point-functions'."

View File

@@ -30,7 +30,7 @@
;;; Code: ;;; Code:
(defun gdscript--get-package-file-content-as-string (file-path-relative) (defun gdscript--get-file-content-as-string (file-path-relative)
"Returns the content of a file in this package as a list of "Returns the content of a file in this package as a list of
strings. Used to retrieve lists of keywords for syntax strings. Used to retrieve lists of keywords for syntax
highlighting. highlighting.
@@ -40,7 +40,7 @@ file without the directory path. This is for compatibility with
the Doom Emacs distribution, which flattens the package's the Doom Emacs distribution, which flattens the package's
structure." structure."
(with-temp-buffer (with-temp-buffer
(setq this-directory (file-name-directory (or load-file-name buffer-file-name))) (setq this-directory (file-name-directory "gdscript-mode.el"))
(setq requested-path (concat this-directory file-path-relative)) (setq requested-path (concat this-directory file-path-relative))
(setq file-path (if (file-readable-p requested-path) (setq file-path (if (file-readable-p requested-path)
requested-path requested-path
@@ -50,12 +50,16 @@ structure."
(split-string (buffer-string) (split-string (buffer-string)
"\n" "\n"
t))) t)))
(defconst gdscript-keywords (eval-when-compile (gdscript--get-file-content-as-string "data/keywords.txt")))
(defconst gdscript-built-in-constants (eval-when-compile (gdscript--get-file-content-as-string "data/built-in-constants.txt")))
;; Only contains types that are not classes and that the Godot editor highlights ;; Only contains types that are not classes and that the Godot editor highlights
;; like built-in keywords ;; like built-in keywords
(defconst gdscript-built-in-types (gdscript--get-package-file-content-as-string "data/built-in-types.txt")) (defconst gdscript-built-in-types (eval-when-compile (gdscript--get-file-content-as-string "data/built-in-types.txt")))
(defconst gdscript-built-in-functions (gdscript--get-package-file-content-as-string "data/built-in-functions.txt")) (defconst gdscript-built-in-functions (eval-when-compile (gdscript--get-file-content-as-string "data/built-in-functions.txt")))
;; Contains all engine classes and node types, including vectors, transforms, etc. ;; Contains all engine classes and node types, including vectors, transforms, etc.
(defconst gdscript-built-in-classes (gdscript--get-package-file-content-as-string "data/built-in-classes.txt")) (defconst gdscript-built-in-classes (eval-when-compile (gdscript--get-file-content-as-string "data/built-in-classes.txt")))
(defun regex-maker (words) (defun regex-maker (words)
(regexp-opt words 'symbols)) (regexp-opt words 'symbols))