- Notifications
You must be signed in to change notification settings - Fork8
A Tree-sitter based major mode for editing PHP codes
License
emacs-php/php-ts-mode
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
A Tree-sitter based major mode for editing PHP codes.
Note
This package is based on Emacs 29's built-intreesit andc-ts-common features.php-ts-mode has been tested withv0.21.1 oftree-sitter-php.
If you haven't installed Tree-sitter yet, please readHow to Get Started with Tree-Sitter - Mastering Emacs. At this point, Tree-sitter may be too early for those who cannot compile and install it themselves. You will end up recompiling it with every future update oftree-sitter-php.
Package can be installed by running the following command.
M-x package-vc-install [RET] https://github.com/emacs-php/php-ts-modeExample configuration that you can put in your.emacs file
;; Enable variables highlighting(customize-set-variable 'treesit-font-lock-level 4)(add-hook 'php-ts-mode-hook (lambda () ;; Use spaces for indent (setq-local indent-tabs-mode nil)))If you don't already havephp-ts-mode installed, please evaluate the Lisp code below.
(add-to-list'treesit-language-source-alist '(php"https://github.com/tree-sitter/tree-sitter-php""master""php/src"))
RunningM-x treesit-install-language-grammar [RET] php will compile and install the latesttree-sitter-php.
Inphp-ts-mode, syntax elements are classified as follows.
- Level 1:
commentdefinitionpreprocessor - Level 2:
keywordstringtype - Level 3:
functionconstantlabel - Level 4:
bracketdelimiteroperatorvariablesthis
By default, up toLevel 3 will be highlighted.
- Chekouttree-sitter-php to your computer.
- Do
make install
This code is currently based onjava-ts-mode.
Copyright (C) 2022-2023 Free Software Foundation, Inc.Copyright (C) 2023 Friends of Emacs-PHP development
This program is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation, either version 3 of the License, or(at your option) any later version.
This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.
You should have received a copy of the GNU General Public Licensealong with this program. If not, seehttps://www.gnu.org/licenses/.
There are plans to transfer this project to GNU Emacs, so if you haven't assigned a copyright to the FSF yet, please refer to theOrg-mode contribute guide and send me an email!
About
A Tree-sitter based major mode for editing PHP codes
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Uh oh!
There was an error while loading.Please reload this page.
Contributors7
Uh oh!
There was an error while loading.Please reload this page.