File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3232(require 'php-mode )
3333(require 'php-extras )
3434(require 'json )
35+ (require 'shr )
3536
3637
3738
5960 :size length
6061 :rehash-threshold 1.0
6162 :rehash-size 100
62- :test 'equal )))
63+ :test 'equal ))
64+ doc)
6365 (dolist (elem data)
6466 (setq count (+ count 1 ))
6567 ; ; Skip methods for now: is there anything more intelligent we
6668 ; ; could do with them?
6769 (unless (string-match-p " ::" (symbol-name (car elem)))
6870 (setq progress (* 100 (/ (float count) length )))
6971 (message " [%2 d%% ] Adding function: %s ... " progress (car elem))
70- (puthash (symbol-name (car elem)) (cdr elem) function-arguments-temp)))
72+ (setq doc (concat
73+ (cdr (assoc 'purpose (cdr elem)))
74+ " \n\n "
75+ (cdr (assoc 'prototype (cdr elem)))
76+ " \n\n "
77+ ; ; The return element is HTML - use `shr' to
78+ ; ; render it back to plain text.
79+ (save-window-excursion
80+ (with-temp-buffer
81+ (insert (cdr (assoc 'return (cdr elem))))
82+ (shr-render-buffer (current-buffer ))
83+ (buffer-string )))))
84+ (puthash (symbol-name (car elem)) (cons `(documentation . , doc ) (cdr elem)) function-arguments-temp)))
7185 ; ; PHP control structures are not present in JSON list. We add
7286 ; ; them here (hard coded - there are not so many of them).
7387 (let ((php-control-structures '(" if" " else" " elseif" " while" " do.while" " for" " foreach" " break" " continue" " switch" " declare" " return" " require" " include" " require_once" " include_once" " goto" )))
Original file line number Diff line number Diff line change 55; ; Author: Arne Jørgensen <arne@arnested.dk>
66; ; URL: https://github.com/arnested/php-extras
77; ; Created: June 28, 2012
8- ; ; Version: 2.0 .0
8+ ; ; Version: 2.1 .0
99; ; Package-Requires: ((php-mode "1.5.0"))
1010; ; Keywords: programming, php
1111
@@ -138,11 +138,17 @@ documentation for the inserted selection."
138138 (fboundp 'eldoc-message ))
139139 (eldoc-message (funcall eldoc-documentation-function)))))
140140
141+ (defun php-extras-function-documentation (symbol )
142+ " Documentation for PHP function."
143+ (php-extras-get-function-property symbol 'documentation ))
144+
141145(defvar ac-source-php-extras
142146 '((candidates . php-extras-autocomplete-candidates)
143147 (candidate-face . php-extras-autocomplete-candidate-face)
144148 (selection-face . php-extras-autocomplete-selection-face)
149+ (document . php-extras-function-documentation)
145150 (action . php-extras-ac-insert-action)
151+ (symbol . " f" )
146152 (cache))
147153 " Auto complete source for PHP functions." )
148154
You can’t perform that action at this time.
0 commit comments