Using ede-php-autoload with PHP-mode
还没有人认领这个 Issue。
评估
调研方向
首先查看 issue 中展示的 PHP-mode 集成点,尤其是 php-mode-hook、php-mode-map 以及 ede-php-autoload 的使用示例。该 issue 没有定义具体的更改或测试;只有在就期望的集成行为和验收检查达成一致后,工作才算完成。
由索引模型根据 Issue 内容生成。
描述
ede-php-autoload is a fantastic package that enables Emacs to understand the dependencies of PHP projects, the most immediate benefit of this is that Emacs can translate class names into files, for example allowing you to jump to the definition of a third-party package with the flick of a button.
The package provides PSR-0 and PSR-4 autoload capabilities to the SemanticDB Emacs subsystem and it can be either used as part of the Semantic parsing system, or with some customisation as a standalone package that doesn't require semantic-mode to be active on your php buffers.
Since ede-php-autoload is by nature designed to work in conjunction with semantic PHP parsers, here's a couple of implementations that's worth knowing about:
- @jorissteyn's EDEP package is being updated to work in tandem with
ede-php-autoload. - @stevenremot has originally written
ede-php-autoloadas part of his work to update the CEDET contrib PHP parser to suit the updated PHP syntax, so it's inherently designed to work with it. Here's a version of the CEDET Contrib PHP parser that works withede-php-autoloadand the built-in CEDET version shipped with Emacs 24 and 25.
I personally am using ede-php-autoload without semantic-mode so I've hacked a function that uses it to jump to the declaration of a class imported with use.
(defun ofc/tags-find-at-point ()
"Finds the definitions of the symbol at point using a tag file."
(interactive)
(xref-find-definitions (thing-at-point 'sexp)))
(defun ofc/visit-class-file-at-point ()
"Maps a FQN into a file name using PHP autoload resolution."
(interactive)
(let* ((class-name (replace-regexp-in-string "^\\\\" "" (thing-at-point 'sexp)))
(class-file (ede-php-autoload-find-class-def-file (ede-current-project) class-name)))
(when class-file
(xref-push-marker-stack)
(find-file class-file))))
(defun ofc/php-tags-find-at-point ()
"When called on a FQN, it resolves its name and jumps to the file where it's defined.
When called on anything else it forwards the call to a tag search function."
(interactive)
(unless (ofc/visit-class-file-at-point)
(ofc/tags-find-at-point)))
(global-ede-mode 1)
(add-hook 'php-mode-hook #'ede-php-autoload-mode)
(define-key php-mode-map (kbd "M-.") 'ofc/php-tags-find-at-point)
I would be interested in knowing how @jorissteyn and @stevenremot are using it.
- 主要语言
- Emacs Lisp
- 星标
- 604
- 派生
- 117
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
emacs-php/php-mode 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 45/100
-
难度 3/5 1-2 天 新手友好度 45/100
-
难度 3/5 1-2 天 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 20/100
-
难度 3/5 1-2 天 新手友好度 45/100
查看 emacs-php/php-mode 的全部 Issue
相似的 Issue
-
False Negative: InnerTypeLastCheck does not report members declared after inner enums or annotations未关闭
难度 2/5 1-3 小时 新手友好度 78/100
checkstyle/checkstyle#22027 ·
维护者通常 1 天内回复
-
good first issue hacktoberfest skip-changelog
难度 2/5 1-3 小时 新手友好度 95/100
wassim-azi/agy-powerline#69 ·
维护者通常 1 天内回复
-
good first issue
难度 1/5 1 小时以内 新手友好度 94/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
enhancement priority:p3 track:open-source
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复