[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode 67b8701 244/405: Decreased length of imenu it
From: |
Stefan Monnier |
Subject: |
[elpa] externals/phps-mode 67b8701 244/405: Decreased length of imenu items to prevent truncation |
Date: |
Sat, 13 Jul 2019 10:00:24 -0400 (EDT) |
branch: externals/phps-mode
commit 67b8701c537252047f942a6de5644f4bc9a4e7b8
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>
Decreased length of imenu items to prevent truncation
---
phps-mode-functions.el | 13 ++++++-------
phps-mode-test-functions.el | 8 ++++----
2 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/phps-mode-functions.el b/phps-mode-functions.el
index e7b54fd..9e405a1 100644
--- a/phps-mode-functions.el
+++ b/phps-mode-functions.el
@@ -618,7 +618,6 @@
;; (message "phps-mode-functions-after-change %s %s %s" start stop length)
))
-;; TODO Implement this
(defun phps-mode-functions-imenu-create-index-function ()
"Create index for imenu."
(let ((index '()))
@@ -669,7 +668,7 @@
(setq in-namespace-declaration nil))
((equal token-symbol 'T_STRING)
- (let ((index-name (format "namespace %s"
(buffer-substring-no-properties token-start token-end)))
+ (let ((index-name (format "\\%s"
(buffer-substring-no-properties token-start token-end)))
(index-pos token-start))
(setq in-namespace-name index-name)
(push `(,index-name . ,index-pos) index)))))
@@ -682,11 +681,11 @@
(setq in-class-declaration nil))
((equal token-symbol 'T_STRING)
- (let ((index-name (format "class %s"
(buffer-substring-no-properties token-start token-end)))
+ (let ((index-name (format "%s" (buffer-substring-no-properties
token-start token-end)))
(index-pos token-start))
(setq in-class-name index-name)
(when in-namespace-name
- (setq index-name (concat in-namespace-name " \\ "
index-name)))
+ (setq index-name (concat in-namespace-name "\\"
index-name)))
(push `(,index-name . ,index-pos) index)))))
(in-function-declaration
@@ -700,12 +699,12 @@
(setq in-function-declaration nil))
((equal token-symbol 'T_STRING)
- (let ((index-name (format "function %s"
(buffer-substring-no-properties token-start token-end)))
+ (let ((index-name (format "%s()"
(buffer-substring-no-properties token-start token-end)))
(index-pos token-start))
(when in-class-name
- (setq index-name (concat in-class-name " -> " index-name)))
+ (setq index-name (concat in-class-name "->" index-name)))
(when in-namespace-name
- (setq index-name (concat in-namespace-name " \\ "
index-name)))
+ (setq index-name (concat in-namespace-name "\\"
index-name)))
(push `(,index-name . ,index-pos) index)))))
(t
diff --git a/phps-mode-test-functions.el b/phps-mode-test-functions.el
index a9550e9..3b7e320 100644
--- a/phps-mode-test-functions.el
+++ b/phps-mode-test-functions.el
@@ -589,22 +589,22 @@
(phps-mode-test-with-buffer
"<?php\nfunction myFunctionA() {}\nfunction myFunctionB() {}\n"
"Imenu function-oriented file"
- (should (equal (phps-mode-functions-imenu-create-index-function)
'(("function myFunctionA" . 16) ("function myFunctionB" . 42)))))
+ (should (equal (phps-mode-functions-imenu-create-index-function)
'(("myFunctionA()" . 16) ("myFunctionB()" . 42)))))
(phps-mode-test-with-buffer
"<?php\nclass myClass {\n public function myFunctionA() {}\n
protected function myFunctionB() {}\n}\n"
"Imenu object-oriented file"
- (should (equal (phps-mode-functions-imenu-create-index-function) '(("class
myClass" . 13) ("class myClass -> function myFunctionA" . 43) ("class myClass
-> function myFunctionB" . 83)))))
+ (should (equal (phps-mode-functions-imenu-create-index-function)
'(("myClass" . 13) ("myClass->myFunctionA()" . 43) ("myClass->myFunctionB()" .
83)))))
(phps-mode-test-with-buffer
"<?php\nnamespace myNamespace {\n class myClass {\n public
function myFunctionA() {}\n protected function myFunctionB() {}\n
}\n}\n"
"Imenu object-oriented file with namespace, class and function"
- (should (equal (phps-mode-functions-imenu-create-index-function)
'(("namespace myNamespace" . 17) ("namespace myNamespace \\ class myClass" .
41) ("namespace myNamespace \\ class myClass -> function myFunctionA" . 75)
("namespace myNamespace \\ class myClass -> function myFunctionB" . 119)))))
+ (should (equal (phps-mode-functions-imenu-create-index-function)
'(("\\myNamespace" . 17) ("\\myNamespace\\myClass" . 41)
("\\myNamespace\\myClass->myFunctionA()" . 75)
("\\myNamespace\\myClass->myFunctionB()" . 119)))))
(phps-mode-test-with-buffer
"<?php\nnamespace myNamespace;\nclass myClass {\n public function
myFunctionA() {}\n protected function myFunctionB() {}\n}\n"
"Imenu object-oriented file with bracket-less namespace, class and function"
- (should (equal (phps-mode-functions-imenu-create-index-function)
'(("namespace myNamespace" . 17) ("namespace myNamespace \\ class myClass" .
36) ("namespace myNamespace \\ class myClass -> function myFunctionA" . 66)
("namespace myNamespace \\ class myClass -> function myFunctionB" . 106)))))
+ (should (equal (phps-mode-functions-imenu-create-index-function)
'(("\\myNamespace" . 17) ("\\myNamespace\\myClass" . 36)
("\\myNamespace\\myClass->myFunctionA()" . 66)
("\\myNamespace\\myClass->myFunctionB()" . 106)))))
)
- [elpa] externals/phps-mode f7186a1 239/405: Preparations for hierarchical imenu, (continued)
- [elpa] externals/phps-mode f7186a1 239/405: Preparations for hierarchical imenu, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 43bf350 216/405: Added tests for token-less lines, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 0de10fa 235/405: Passes first test for imenu, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode f791cee 234/405: Started on unit tests for imenu-index generation, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode b56a15c 233/405: Removed debugging output, updated todo items, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 73784d0 225/405: Cleaned up tests for indentation, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode f7e7c74 219/405: Work on indentation for switch-case, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode c2af31e 240/405: Imenu support now shows hierarchical information, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 55953de 232/405: Lexer now doesn't find keywords in function names, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode b8e9449 247/405: Refactored Imenu to use a persistent variable per buffer, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 67b8701 244/405: Decreased length of imenu items to prevent truncation,
Stefan Monnier <=
- [elpa] externals/phps-mode e78d8ed 248/405: Clean-up of indentation code, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode c2db7d3 250/405: Preparations for integration test, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 11309b8 256/405: Updated readme, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode fcc920f 258/405: More preparations for merging indent and Imenu into one function, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 41c12c1 251/405: Updated paths for byte-compilation, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 0e927e8 252/405: Fixed compilation command in makefile, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 6593242 257/405: Preparations for doing indentation and imenu in one pass, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 318001e 259/405: Merged Imenu and indentation generation into one iteration of tokens, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 5bb45ce 253/405: Added lexer test for properties inside heredoc, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode caafeba 260/405: Changed idle interval for incremental lexer, Stefan Monnier, 2019/07/13