Skip to content

Commit

Permalink
Merge branch 'release/2.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
arnested committed Mar 9, 2014
2 parents 1c3c41c + 6e0d81b commit 96d7fa6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
18 changes: 16 additions & 2 deletions php-extras-gen-eldoc.el
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
(require 'php-mode)
(require 'php-extras)
(require 'json)
(require 'shr)



Expand Down Expand Up @@ -59,15 +60,28 @@
:size length
:rehash-threshold 1.0
:rehash-size 100
:test 'equal)))
:test 'equal))
doc)
(dolist (elem data)
(setq count (+ count 1))
;; Skip methods for now: is there anything more intelligent we
;; could do with them?
(unless (string-match-p "::" (symbol-name (car elem)))
(setq progress (* 100 (/ (float count) length)))
(message "[%2d%%] Adding function: %s..." progress (car elem))
(puthash (symbol-name (car elem)) (cdr elem) function-arguments-temp)))
(setq doc (concat
(cdr (assoc 'purpose (cdr elem)))
"\n\n"
(cdr (assoc 'prototype (cdr elem)))
"\n\n"
;; The return element is HTML - use `shr' to
;; render it back to plain text.
(save-window-excursion
(with-temp-buffer
(insert (cdr (assoc 'return (cdr elem))))
(shr-render-buffer (current-buffer))
(buffer-string)))))
(puthash (symbol-name (car elem)) (cons `(documentation . ,doc) (cdr elem)) function-arguments-temp)))
;; PHP control structures are not present in JSON list. We add
;; them here (hard coded - there are not so many of them).
(let ((php-control-structures '("if" "else" "elseif" "while" "do.while" "for" "foreach" "break" "continue" "switch" "declare" "return" "require" "include" "require_once" "include_once" "goto")))
Expand Down
8 changes: 7 additions & 1 deletion php-extras.el
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
;; Author: Arne Jørgensen <[email protected]>
;; URL: https://github.com/arnested/php-extras
;; Created: June 28, 2012
;; Version: 2.0.0
;; Version: 2.1.0
;; Package-Requires: ((php-mode "1.5.0"))
;; Keywords: programming, php

Expand Down Expand Up @@ -138,11 +138,17 @@ documentation for the inserted selection."
(fboundp 'eldoc-message))
(eldoc-message (funcall eldoc-documentation-function)))))

(defun php-extras-function-documentation (symbol)
"Documentation for PHP function."
(php-extras-get-function-property symbol 'documentation))

(defvar ac-source-php-extras
'((candidates . php-extras-autocomplete-candidates)
(candidate-face . php-extras-autocomplete-candidate-face)
(selection-face . php-extras-autocomplete-selection-face)
(document . php-extras-function-documentation)
(action . php-extras-ac-insert-action)
(symbol . "f")
(cache))
"Auto complete source for PHP functions.")

Expand Down

0 comments on commit 96d7fa6

Please sign in to comment.