pkg update and first config fix
org-brain not working, add org-roam
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
;;; php-mode.el --- Major mode for editing PHP code -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2020 Friends of Emacs-PHP development
|
||||
;; Copyright (C) 2022 Friends of Emacs-PHP development
|
||||
;; Copyright (C) 1999, 2000, 2001, 2003, 2004 Turadg Aleahmad
|
||||
;; 2008 Aaron S. Hawley
|
||||
;; 2011, 2012, 2013, 2014, 2015, 2016, 2017 Eric James Michael Ritz
|
||||
@@ -9,12 +9,14 @@
|
||||
;; Maintainer: USAMI Kenta <tadsan@zonu.me>
|
||||
;; URL: https://github.com/emacs-php/php-mode
|
||||
;; Keywords: languages php
|
||||
;; Version: 1.24.0
|
||||
;; Version: 1.24.2
|
||||
;; Package-Requires: ((emacs "25.2"))
|
||||
;; License: GPL-3.0-or-later
|
||||
|
||||
(defconst php-mode-version-number "1.24.0"
|
||||
"PHP Mode version number.")
|
||||
(eval-and-compile
|
||||
(make-obsolete-variable
|
||||
(defconst php-mode-version-number "1.24.2" "PHP Mode version number.")
|
||||
"Please call (php-mode-version :as-number t) for compatibility." "1.24.2"))
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
@@ -79,14 +81,47 @@
|
||||
(eval-when-compile
|
||||
(require 'rx)
|
||||
(require 'cl-lib)
|
||||
(require 'flymake)
|
||||
(require 'php-flymake)
|
||||
(require 'regexp-opt)
|
||||
(declare-function acm-backend-tabnine-candidate-expand "ext:acm-backend-tabnine"
|
||||
(candidate-info bound-start))
|
||||
(defvar add-log-current-defun-header-regexp)
|
||||
(defvar add-log-current-defun-function)
|
||||
(defvar c-syntactic-context)
|
||||
(defvar c-vsemi-status-unknown-p)
|
||||
(defvar syntax-propertize-via-font-lock))
|
||||
|
||||
(defconst php-mode-version-id
|
||||
(eval-when-compile
|
||||
(let ((fallback-version (format "%s-non-vcs" (with-no-warnings php-mode-version-number))))
|
||||
(if (locate-dominating-file default-directory ".git")
|
||||
(save-match-data
|
||||
(let ((tag (replace-regexp-in-string
|
||||
(rx bos "v") ""
|
||||
(shell-command-to-string "git describe --tags")))
|
||||
(pattern (rx (group (+ any)) eol)))
|
||||
(if (string-match pattern tag)
|
||||
(match-string 0 tag)
|
||||
(error "Faild to obtain git tag"))))
|
||||
fallback-version)))
|
||||
"PHP Mode build ID.
|
||||
|
||||
The format is follows:
|
||||
|
||||
\"1.23.4\": Tagged revision, compiled under Git VCS.
|
||||
\"1.23.4-56-xxxxxx\": 56 commits after the last tag release, compiled under Git.
|
||||
\"1.23.4-non-vcs\": Compiled in an environment not managed by Git VCS.")
|
||||
|
||||
(autoload 'php-mode-debug "php-mode-debug"
|
||||
"Display informations useful for debugging PHP Mode." t)
|
||||
|
||||
(autoload 'php-mode-debug-reinstall "php-mode-debug"
|
||||
"Reinstall PHP Mode to solve Cc Mode version mismatch.
|
||||
|
||||
When FORCE, try to reinstall without interactively asking.
|
||||
When CALLED-INTERACTIVE then message the result." t)
|
||||
|
||||
|
||||
;; Local variables
|
||||
|
||||
@@ -155,6 +190,15 @@ Turning this on will open it whenever `php-mode' is loaded."
|
||||
:tag "PHP Mode Page Delimiter"
|
||||
:type 'regexp)
|
||||
|
||||
(defcustom php-mode-replace-flymake-diag-function
|
||||
(eval-when-compile (when (boundp 'flymake-diagnostic-functions)
|
||||
#'php-flymake))
|
||||
"Flymake function to replace, if NIL do not replace."
|
||||
:group 'php-mode
|
||||
:tag "PHP Mode Replace Flymake Diag Function"
|
||||
:type '(choice 'function
|
||||
(const :tag "Disable to replace" nil)))
|
||||
|
||||
(define-obsolete-variable-alias 'php-do-not-use-semantic-imenu 'php-mode-do-not-use-semantic-imenu "1.20.0")
|
||||
(defcustom php-mode-do-not-use-semantic-imenu t
|
||||
"Customize `imenu-create-index-function' for `php-mode'.
|
||||
@@ -210,7 +254,7 @@ enabled."
|
||||
:type 'hook)
|
||||
|
||||
(defcustom php-mode-force-pear nil
|
||||
"Normally PEAR coding rules are enforced only when the filename contains \"PEAR.\"
|
||||
"Normally PEAR coding rules are enforced only when the filename contains \"PEAR\".
|
||||
Turning this on will force PEAR rules on all PHP files."
|
||||
:group 'php-mode
|
||||
:tag "PHP Mode Force Pear"
|
||||
@@ -226,7 +270,7 @@ have any tags inside a PHP string, it will be fooled."
|
||||
:type '(choice (const :tag "Warn" t) (const "Don't warn" nil)))
|
||||
|
||||
(defcustom php-mode-coding-style 'pear
|
||||
"Select default coding style to use with php-mode.
|
||||
"Select default coding style to use with `php-mode'.
|
||||
This variable can take one of the following symbol values:
|
||||
|
||||
`Default' - use a reasonable default style for PHP.
|
||||
@@ -248,7 +292,7 @@ This variable can take one of the following symbol values:
|
||||
;; Since this function has a bad influence on the environment of many users,
|
||||
;; temporarily disable it
|
||||
(defcustom php-mode-enable-project-coding-style nil
|
||||
"When set to true override php-mode-coding-style by php-project-coding-style.
|
||||
"When set to true override `php-mode-coding-style' by `php-project-coding-style'.
|
||||
|
||||
If you want to suppress styles from being overwritten by directory / file
|
||||
local variables, set NIL."
|
||||
@@ -265,18 +309,13 @@ In that case set to `NIL'."
|
||||
:tag "PHP Mode Enable Backup Style Variables"
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom php-mode-disable-c-auto-align-backslashes t
|
||||
"When set to non-NIL, override `c-auto-align-backslashes' to NIL."
|
||||
:group 'php-mode
|
||||
:tag "PHP Mode Disable c-auto-align-backslashes"
|
||||
:type 'boolean)
|
||||
|
||||
(define-obsolete-variable-alias 'php-mode-disable-parent-mode-hooks 'php-mode-disable-c-mode-hook "1.21.0")
|
||||
(defcustom php-mode-disable-c-mode-hook t
|
||||
"When set to `T', do not run hooks of parent modes (`java-mode', `c-mode')."
|
||||
:group 'php-mode
|
||||
:tag "PHP Mode Disable C Mode Hook"
|
||||
:type 'boolean)
|
||||
(make-obsolete-variable 'php-mode-disable-c-mode-hook nil "1.24.2")
|
||||
|
||||
(defcustom php-mode-enable-project-local-variable t
|
||||
"When set to `T', apply project local variable to buffer local variable."
|
||||
@@ -284,22 +323,23 @@ In that case set to `NIL'."
|
||||
:tag "PHP Mode Enable Project Local Variable"
|
||||
:type 'boolean)
|
||||
|
||||
(defconst php-mode-cc-vertion
|
||||
(defconst php-mode-cc-version
|
||||
(eval-when-compile c-version))
|
||||
|
||||
(defun php-mode-version ()
|
||||
"Display string describing the version of PHP Mode."
|
||||
(interactive)
|
||||
(let ((fmt
|
||||
(eval-when-compile
|
||||
(let ((id "$Id$"))
|
||||
(concat "PHP Mode %s"
|
||||
(if (string= id (concat [?$ ?I ?d ?$]))
|
||||
""
|
||||
(concat " " id)))))))
|
||||
(cl-defun php-mode-version (&key as-number)
|
||||
"Display string describing the version of PHP Mode.
|
||||
|
||||
Although this is an interactive command, it returns a string when called
|
||||
as a function. Call with AS-NUMBER keyword to compare by `version<'.
|
||||
|
||||
\(version<= \"1.24.1\" (php-mode-version :as-number t))"
|
||||
(interactive (list :as-number nil))
|
||||
(if as-number
|
||||
(save-match-data (and (string-match (rx (group (+ (in ".0-9")))) php-mode-version-id)
|
||||
(match-string 0 php-mode-version-id)))
|
||||
(funcall
|
||||
(if (called-interactively-p 'interactive) #'message #'format)
|
||||
fmt php-mode-version-number)))
|
||||
"PHP Mode v%s" php-mode-version-id)))
|
||||
|
||||
;;;###autoload
|
||||
(define-obsolete-variable-alias 'php-available-project-root-files 'php-project-available-root-files "1.19.0")
|
||||
@@ -412,7 +452,8 @@ In that case set to `NIL'."
|
||||
(left-assoc "and")
|
||||
(left-assoc "xor")
|
||||
(left-assoc "or")
|
||||
(left-assoc ",")))
|
||||
(left-assoc ",")
|
||||
(left-assoc "=>")))
|
||||
|
||||
;; Allow '\' when scanning from open brace back to defining
|
||||
;; construct like class
|
||||
@@ -574,9 +615,6 @@ might be to handle switch and goto labels differently."
|
||||
php (cl-remove-if (lambda (elm) (and (listp elm) (memq 'c-annotation-face elm)))
|
||||
(c-lang-const c-basic-matchers-after php)))
|
||||
|
||||
(c-lang-defconst c-opt-<>-sexp-key
|
||||
php nil)
|
||||
|
||||
(defconst php-mode--re-return-typed-closure
|
||||
(eval-when-compile
|
||||
(rx symbol-start "function" symbol-end
|
||||
@@ -591,7 +629,8 @@ might be to handle switch and goto labels differently."
|
||||
(group "{"))))
|
||||
|
||||
(defun php-c-lineup-arglist (langelem)
|
||||
"Line up the current argument line under the first argument using `c-lineup-arglist' LANGELEM."
|
||||
"Line up the current argument line under the first argument using
|
||||
`c-lineup-arglist' LANGELEM."
|
||||
(let (in-return-typed-closure)
|
||||
(when (and (consp langelem)
|
||||
(eq 'arglist-cont-nonempty (car langelem)))
|
||||
@@ -606,12 +645,40 @@ might be to handle switch and goto labels differently."
|
||||
|
||||
(defun php-lineup-cascaded-calls (langelem)
|
||||
"Line up chained methods using `c-lineup-cascaded-calls',
|
||||
but only if the setting is enabled"
|
||||
(if php-mode-lineup-cascaded-calls
|
||||
(c-lineup-cascaded-calls langelem)
|
||||
but only if the setting is enabled."
|
||||
(cond
|
||||
(php-mode-lineup-cascaded-calls (c-lineup-cascaded-calls langelem))
|
||||
((assq 'arglist-cont-nonempty c-syntactic-context) nil)
|
||||
((assq 'defun-block-intro c-syntactic-context) nil)
|
||||
((assq 'defun-close c-syntactic-context) nil)
|
||||
((assq 'statement-cont c-syntactic-context) nil)
|
||||
(t
|
||||
(save-excursion
|
||||
(beginning-of-line)
|
||||
(if (looking-at-p "\\s-*->") '+ nil))))
|
||||
(let ((beginning-of-langelem (cdr langelem))
|
||||
(beginning-of-current-line (point))
|
||||
start)
|
||||
(skip-chars-forward " ")
|
||||
(cond
|
||||
((looking-at-p "->") '+)
|
||||
((looking-at-p "[:?]") '+)
|
||||
((looking-at-p "[,;]") nil)
|
||||
;; Is the previous line terminated with `,' ?
|
||||
((progn
|
||||
(forward-line -1)
|
||||
(end-of-line)
|
||||
(skip-chars-backward " ")
|
||||
(backward-char 1)
|
||||
(while (and (< beginning-of-langelem (point))
|
||||
(setq start (php-in-string-or-comment-p)))
|
||||
(goto-char start)
|
||||
(skip-chars-backward " ")
|
||||
(backward-char 1))
|
||||
(and (not (eq (point) beginning-of-current-line))
|
||||
(not (looking-at-p ","))
|
||||
(not (php-in-string-or-comment-p))))
|
||||
'+)
|
||||
(t nil)))))))
|
||||
|
||||
(defun php-c-looking-at-or-maybe-in-bracelist (&optional _containing-sexp lim)
|
||||
"Replace `c-looking-at-or-maybe-in-bracelist'.
|
||||
@@ -669,7 +736,7 @@ a backward search limit."
|
||||
(tab-width . 4)))
|
||||
|
||||
(defun php-enable-pear-coding-style ()
|
||||
"Set up php-mode to use the coding styles preferred for PEAR code and modules."
|
||||
"Set up `php-mode' to use the coding styles preferred for PEAR code and modules."
|
||||
(interactive)
|
||||
(php-set-style "pear"))
|
||||
|
||||
@@ -684,7 +751,7 @@ a backward search limit."
|
||||
(php-style-delete-trailing-whitespace . t)))
|
||||
|
||||
(defun php-enable-drupal-coding-style ()
|
||||
"Make php-mode use coding styles that are preferable for working with Drupal."
|
||||
"Make `php-mode' use coding styles that are preferable for working with Drupal."
|
||||
(interactive)
|
||||
(php-set-style "drupal"))
|
||||
|
||||
@@ -698,7 +765,8 @@ a backward search limit."
|
||||
(fill-column . 78)))
|
||||
|
||||
(defun php-enable-wordpress-coding-style ()
|
||||
"Make php-mode use coding styles that are preferable for working with Wordpress."
|
||||
"Make `php-mode' use coding styles that are preferable for working with
|
||||
Wordpress."
|
||||
(interactive)
|
||||
(php-set-style "wordpress"))
|
||||
|
||||
@@ -711,7 +779,7 @@ a backward search limit."
|
||||
(fill-column . 78)))
|
||||
|
||||
(defun php-enable-symfony2-coding-style ()
|
||||
"Make php-mode use coding styles that are preferable for working with Symfony2."
|
||||
"Make `php-mode' use coding styles that are preferable for working with Symfony2."
|
||||
(interactive)
|
||||
(php-set-style "symfony2"))
|
||||
|
||||
@@ -726,7 +794,7 @@ a backward search limit."
|
||||
(php-style-delete-trailing-whitespace . t)))
|
||||
|
||||
(defun php-enable-psr2-coding-style ()
|
||||
"Make php-mode comply to the PSR-2 coding style."
|
||||
"Make `php-mode' comply to the PSR-2 coding style."
|
||||
(interactive)
|
||||
(php-set-style "psr2"))
|
||||
|
||||
@@ -772,9 +840,8 @@ See `php-beginning-of-defun'."
|
||||
(save-match-data
|
||||
(not (or (re-search-forward html-tag-re (line-end-position) t)
|
||||
(re-search-backward html-tag-re (line-beginning-position) t)))))
|
||||
(progn
|
||||
(goto-char here)
|
||||
t)
|
||||
(prog1 t
|
||||
(goto-char here))
|
||||
(goto-char here)
|
||||
(setq php-warned-bad-indent t)
|
||||
(let* ((known-multi-libs '(("mumamo" mumamo (lambda () (nxhtml-mumamo)))
|
||||
@@ -835,9 +902,9 @@ example `html-mode'. Known such libraries are:\n\t"
|
||||
nil))))
|
||||
|
||||
(defun php-cautious-indent-region (start end &optional quiet)
|
||||
"Carefully indent region `START' `END' in contexts other than HTML templates.
|
||||
"Carefully indent region START to END in contexts other than HTML templates.
|
||||
|
||||
If the optional argument `QUIET' is non-nil then no syntactic errors are
|
||||
If the optional argument QUIET is non-nil then no syntactic errors are
|
||||
reported, even if `c-report-syntactic-errors' is non-nil."
|
||||
(if (or (not php-mode-warn-if-mumamo-off)
|
||||
(not (php-in-poly-php-html-mode))
|
||||
@@ -852,9 +919,6 @@ reported, even if `c-report-syntactic-errors' is non-nil."
|
||||
php-warned-bad-indent
|
||||
(php-check-html-for-indentation))
|
||||
(let ((here (point))
|
||||
(c-auto-align-backslashes
|
||||
(unless php-mode-disable-c-auto-align-backslashes
|
||||
c-auto-align-backslashes))
|
||||
doit)
|
||||
(move-beginning-of-line nil)
|
||||
;; Don't indent heredoc end mark
|
||||
@@ -899,8 +963,8 @@ This is was done due to the problem reported here:
|
||||
(defun php-lineup-string-cont (langelem)
|
||||
"Line up string toward equal sign or dot.
|
||||
e.g.
|
||||
$str = 'some'
|
||||
. 'string';
|
||||
$str \= \'some\'
|
||||
. \'string\';
|
||||
this ^ lineup"
|
||||
(save-excursion
|
||||
(goto-char (cdr langelem))
|
||||
@@ -942,7 +1006,8 @@ this ^ lineup"
|
||||
"Regular expression for the start of a PHP heredoc."))
|
||||
|
||||
(defun php-heredoc-end-re (heredoc-start)
|
||||
"Build a regular expression for the end of a heredoc started by the string HEREDOC-START."
|
||||
"Build a regular expression for the end of a heredoc started by the string
|
||||
HEREDOC-START."
|
||||
;; Extract just the identifier without <<< and quotes.
|
||||
(string-match "\\_<.+?\\_>" heredoc-start)
|
||||
(concat "^\\s-*\\(" (match-string 0 heredoc-start) "\\)\\W"))
|
||||
@@ -983,7 +1048,7 @@ this ^ lineup"
|
||||
(put-text-property start (1+ start) 'syntax-table (string-to-syntax "."))))
|
||||
|
||||
(defvar-local php-mode--propertize-extend-region-current nil
|
||||
"Prevent undesirable recursion in PHP-SYNTAX-PROPERTIZE-EXTEND-REGION")
|
||||
"Prevent undesirable recursion in PHP-SYNTAX-PROPERTIZE-EXTEND-REGION.")
|
||||
|
||||
(defun php-syntax-propertize-extend-region (start end)
|
||||
"Extend the propertize region if START or END falls inside a PHP heredoc."
|
||||
@@ -1013,7 +1078,7 @@ this ^ lineup"
|
||||
(setq php-mode--propertize-extend-region-current
|
||||
(delete pair php-mode--propertize-extend-region-current))))))
|
||||
|
||||
(easy-menu-define php-mode-menu php-mode-map "PHP Mode Commands"
|
||||
(easy-menu-define php-mode-menu php-mode-map "PHP Mode Commands."
|
||||
(cons "PHP" (c-lang-const c-mode-menu php)))
|
||||
|
||||
(defun php-mode-get-style-alist ()
|
||||
@@ -1076,7 +1141,7 @@ After setting the stylevars run hooks according to STYLENAME
|
||||
((equal stylename "psr2") (run-hooks 'php-mode-psr2-hook))))
|
||||
|
||||
(defun php-mode--disable-delay-set-style (&rest _args)
|
||||
"Disable php-mode-set-style-delay on after hook. `ARGS' be ignore."
|
||||
"Disable `php-mode-set-style-delay' on after hook. ARGS be ignore."
|
||||
(setq php-mode--delayed-set-style nil)
|
||||
(advice-remove #'php-mode--disable-delay-set-style #'c-set-style))
|
||||
|
||||
@@ -1094,6 +1159,14 @@ After setting the stylevars run hooks according to STYLENAME
|
||||
(php-project-apply-local-variables)
|
||||
(remove-hook 'hack-local-variables-hook #'php-mode-set-local-variable-delay))
|
||||
|
||||
(defun php-mode-neutralize-cc-mode-effect ()
|
||||
"Reset PHP-irrelevant variables set by Cc Mode initialization."
|
||||
(setq-local c-mode-hook nil)
|
||||
(setq-local java-mode-hook nil)
|
||||
(when (eval-when-compile (boundp 'flymake-diagnostic-functions))
|
||||
(remove-hook 'flymake-diagnostic-functions 'flymake-cc t))
|
||||
t)
|
||||
|
||||
(defvar php-mode-syntax-table
|
||||
(let ((table (make-syntax-table)))
|
||||
(c-populate-syntax-table table)
|
||||
@@ -1114,18 +1187,19 @@ After setting the stylevars run hooks according to STYLENAME
|
||||
;; :after-hook (c-update-modeline)
|
||||
;; (setq abbrev-mode t)
|
||||
|
||||
(unless (string= php-mode-cc-vertion c-version)
|
||||
(user-error "CC Mode has been updated. %s"
|
||||
(if (package-installed-p 'php-mode)
|
||||
"Please run `M-x package-reinstall php-mode' command."
|
||||
"Please byte recompile PHP Mode files.")))
|
||||
(unless (string= php-mode-cc-version c-version)
|
||||
(php-mode-debug-reinstall))
|
||||
|
||||
(if php-mode-disable-c-mode-hook
|
||||
(php-mode-neutralize-cc-mode-effect)
|
||||
(display-warning 'php-mode
|
||||
"`php-mode-disable-c-mode-hook' will be removed. Do not depends on this variable."
|
||||
:warning))
|
||||
|
||||
(when php-mode-disable-c-mode-hook
|
||||
(setq-local c-mode-hook nil)
|
||||
(setq-local java-mode-hook nil))
|
||||
(c-initialize-cc-mode t)
|
||||
(c-init-language-vars php-mode)
|
||||
(c-common-init 'php-mode)
|
||||
(setq-local c-auto-align-backslashes nil)
|
||||
|
||||
(setq-local comment-start "// ")
|
||||
(setq-local comment-start-skip
|
||||
@@ -1196,11 +1270,20 @@ After setting the stylevars run hooks according to STYLENAME
|
||||
(setq-local add-log-current-defun-function nil)
|
||||
(setq-local add-log-current-defun-header-regexp php-beginning-of-defun-regexp)
|
||||
|
||||
(when (and (eval-when-compile (boundp 'flymake-diagnostic-functions))
|
||||
php-mode-replace-flymake-diag-function)
|
||||
(add-hook 'flymake-diagnostic-functions php-mode-replace-flymake-diag-function nil t))
|
||||
|
||||
(when (fboundp 'c-looking-at-or-maybe-in-bracelist)
|
||||
(advice-add #'c-looking-at-or-maybe-in-bracelist
|
||||
:override 'php-c-looking-at-or-maybe-in-bracelist '(local)))
|
||||
(advice-add #'fixup-whitespace :after #'php-mode--fixup-whitespace-after '(local))
|
||||
|
||||
(when (fboundp #'acm-backend-tabnine-candidate-expand)
|
||||
(advice-add #'acm-backend-tabnine-candidate-expand
|
||||
:filter-args #'php-acm-backend-tabnine-candidate-expand-filter-args
|
||||
'(local)))
|
||||
|
||||
(when (>= emacs-major-version 25)
|
||||
(with-silent-modifications
|
||||
(save-excursion
|
||||
@@ -1248,15 +1331,30 @@ for \\[find-tag] (which see)."
|
||||
(message "Unknown function: %s" tagname))))
|
||||
|
||||
;; Font Lock
|
||||
(defconst php-phpdoc-type-keywords
|
||||
(defconst php-phpdoc-type-names
|
||||
(list "string" "integer" "int" "boolean" "bool" "float"
|
||||
"double" "object" "mixed" "array" "resource"
|
||||
"void" "null" "false" "true" "self" "static"
|
||||
"callable" "iterable" "number"))
|
||||
"callable" "iterable" "number"
|
||||
;; PHPStan and Psalm types
|
||||
"array-key" "associative-array" "callable-array" "callable-object"
|
||||
"callable-string" "class-string" "empty" "enum-string" "list"
|
||||
"literal-string" "negative-int" "non-positive-int" "non-negative-int"
|
||||
"never" "never-return" "never-returns" "no-return" "non-empty-array"
|
||||
"non-empty-list" "non-empty-string" "non-falsy-string"
|
||||
"numeric" "numeric-string" "positive-int" "scalar"
|
||||
"trait-string" "truthy-string" "key-of" "value-of")
|
||||
"A list of type and pseudotype names that can be used in PHPDoc.")
|
||||
|
||||
(make-obsolete-variable 'php-phpdoc-type-keywords 'php-phpdoc-type-names "1.24.2")
|
||||
|
||||
(defconst php-phpdoc-type-tags
|
||||
(list "package" "param" "property" "property-read" "property-write"
|
||||
"return" "throws" "var"))
|
||||
"return" "throws" "var" "self-out" "this-out" "param-out"
|
||||
"type" "extends" "require-extends" "implemtents" "require-implements"
|
||||
"template" "template-covariant" "template-extends" "template-implements"
|
||||
"assert" "assert-if-true" "assert-if-false" "if-this-is")
|
||||
"A list of tags specifying type names.")
|
||||
|
||||
(defconst php-phpdoc-font-lock-doc-comments
|
||||
`(("{@[-[:alpha:]]+\\s-*\\([^}]*\\)}" ; "{@foo ...}" markup.
|
||||
@@ -1266,11 +1364,11 @@ for \\[find-tag] (which see)."
|
||||
(1 'php-doc-variable-sigil prepend nil)
|
||||
(2 'php-variable-name prepend nil))
|
||||
("\\(\\$\\)\\(this\\)\\>" (1 'php-doc-$this-sigil prepend nil) (2 'php-doc-$this prepend nil))
|
||||
(,(concat "\\s-@" (regexp-opt php-phpdoc-type-tags) "\\s-+"
|
||||
(,(concat "\\s-@" (rx (? (or "phan" "phpstan" "psalm") "-")) (regexp-opt php-phpdoc-type-tags) "\\s-+"
|
||||
"\\(" (rx (+ (? "?") (? "\\") (+ (in "0-9A-Z_a-z")) (? "[]") (? "|"))) "\\)+")
|
||||
1 'php-string prepend nil)
|
||||
(,(concat "\\(?:|\\|\\?\\|\\s-\\)\\("
|
||||
(regexp-opt php-phpdoc-type-keywords 'words)
|
||||
(regexp-opt php-phpdoc-type-names 'words)
|
||||
"\\)")
|
||||
1 font-lock-type-face prepend nil)
|
||||
("https?://[^\n\t ]+"
|
||||
@@ -1447,12 +1545,10 @@ for \\[find-tag] (which see)."
|
||||
(defvar php-font-lock-keywords php-font-lock-keywords-3
|
||||
"Default expressions to highlight in PHP Mode.")
|
||||
|
||||
(add-to-list
|
||||
(eval-when-compile
|
||||
(if (boundp 'flymake-proc-allowed-file-name-masks)
|
||||
'flymake-proc-allowed-file-name-masks
|
||||
'flymake-allowed-file-name-masks))
|
||||
'("\\.php[345s]?\\'" php-flymake-php-init))
|
||||
(eval-when-compile
|
||||
(unless (boundp 'flymake-proc-allowed-file-name-masks)
|
||||
(add-to-list 'flymake-allowed-file-name-masks
|
||||
'("\\.php[345s]?\\'" php-flymake-php-init))))
|
||||
|
||||
|
||||
(defun php-send-region (start end)
|
||||
@@ -1491,6 +1587,17 @@ The output will appear in the buffer *PHP*."
|
||||
(forward-char -2)
|
||||
(looking-at-p "->\\|::")))
|
||||
(delete-char 1)))
|
||||
|
||||
;; Advice for lsp-bridge' acm-backend-tabnine
|
||||
;; see https://github.com/manateelazycat/lsp-bridge/issues/402#issuecomment-1305653058
|
||||
(defun php-acm-backend-tabnine-candidate-expand-filter-args (args)
|
||||
"Adjust to replace bound-start ARGS for Tabnine in PHP."
|
||||
(cl-multiple-value-bind (candidate-info bound-start) args
|
||||
(save-excursion
|
||||
(goto-char bound-start)
|
||||
(when (looking-at-p (eval-when-compile (regexp-quote "$")))
|
||||
(setq bound-start (1+ bound-start))))
|
||||
(list candidate-info bound-start)))
|
||||
|
||||
;;;###autoload
|
||||
(progn
|
||||
|
||||
Reference in New Issue
Block a user