   
   (add-to-list 'ac-sources 'ac-source-pjs-namespaces-functions)
   (add-to-list 'ac-sources 'ac-source-pjs-local-vars)
-  (add-to-list 'ac-sources 'ac-source-pjs-variable-members)  
+  (add-to-list 'ac-sources 'ac-source-pjs-variable-members)
+  (add-to-list 'ac-sources 'ac-source-pjs-classes)
  
   ;; (add-to-list 'ac-sources 'ac-source-ojs-vars)
   ;; (add-to-list 'ac-sources 'ac-source-ojs-kernel)

  (save-excursion
    (save-match-data
      (let ((match (re-search-backward (format "\\(\\<%s\\>\\)\\(\\.\\)\\(%s\\)?\\=" *js-variable-name* *js-variable-name*) (line-beginning-position) t)))
	(when match
	  (setq *current-pjs-namespace-prefix* (downcase (match-string-no-properties 1)))
	  (1+ (match-beginning 2)))))))


(require 'auto-complete)

;;;;; configuration of the hook

;;; complete plc. classes names
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(ac-define-source "pjs-classes"
  '((prefix . pjs-classes-ac-prefix)
    (candidates . pjs-classes-ac-candidates)
;;    (document . pjs-namespaces-functions-ac-document)
;;    (action . pjs-namespaces-functions-ac-action)
    (symbol . "c ")
    (requires . -1)))

(defun pjs-classes-ac-prefix ()
  ;; detects the current namespace
  (save-excursion
    (save-match-data
      (let ((match (re-search-backward (format "\\(\\<plc\\>\\)\\(\\.\\)\\(%s\\)?\\=" *js-variable-name*) (line-beginning-position) t)))
	(when match
;;	  (setq *current-pjs-namespace-prefix* "plc")
	  (1+ (match-beginning 2)))))))

(defun pjs-classes-ac-candidates ()
  (list-pjs-plc-types))

;;; find functions and variables from current namespaces.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
