Skip to content

Commit

Permalink
Use semantic for completion instead of homegrown
Browse files Browse the repository at this point in the history
[#29 state:invalid]
[#30 state:invalid]
[#31 state:invalid]
  • Loading branch information
espenhw committed Mar 17, 2009
1 parent 6722975 commit e79d116
Show file tree
Hide file tree
Showing 7 changed files with 147 additions and 360 deletions.
281 changes: 0 additions & 281 deletions src/main/lisp/malabar-complete.el

This file was deleted.

7 changes: 5 additions & 2 deletions src/main/lisp/malabar-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
(require 'malabar-abbrevs)
(require 'malabar-annotations)
(require 'malabar-codegen)
(require 'malabar-complete)
(require 'malabar-groovy)
(require 'malabar-import)
(require 'malabar-misc)
Expand All @@ -44,6 +43,7 @@
(require 'malabar-test)
(require 'malabar-util)
(require 'malabar-variables)
(require 'malabar-semanticdb)

(define-derived-mode malabar-mode java-mode "malabar"
"A new, better, Java mode."
Expand Down Expand Up @@ -138,7 +138,10 @@ present."
:test-not #'eql
:key #'semantic-tag-class)
result))))))
(push (semantic-tag-function-arguments (semantic-current-tag-of-class 'function)) result)
;; Add this and super
(push (list (semantic-tag-new-variable "this" (semantic-tag-name (semantic-current-tag-of-class 'type)))
(semantic-tag-new-variable "super" (semantic-tag-type-superclasses (semantic-current-tag-of-class 'type))))
result)
(apply 'append result)))

(provide 'malabar-mode)
36 changes: 36 additions & 0 deletions src/main/lisp/malabar-reflection.el
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,42 @@ e.g. `malabar-choose'."
unqualified))
(error "Class not found %s" unqualified)))

(defun malabar--get-type-tag (typename &optional buffer)
(let ((class-info (malabar-get-class-info typename buffer)))
(when class-info
(semantic-tag-new-type (malabar--get-name class-info)
(cond ((malabar--interface-p class-info)
"interface")
;; TODO enums
(t
"class"))
(remove nil
(mapcar (lambda (spec)
(cond ((malabar--field-p spec)
(malabar--as-variable-tag spec))
((malabar--method-p spec)
(malabar--as-function-tag spec))
(t
nil)))
(malabar--get-members class-info)))
(cons (malabar--get-super-class class-info)
(malabar--get-interfaces class-info))))))

(defun malabar--as-variable-tag (spec)
nil)

(defun malabar--as-function-tag (spec)
(semantic-tag-new-function (malabar--get-name spec)
(malabar--get-return-type spec)
(let ((arg-name-maker (malabar--arg-name-maker)))
(mapcar (lambda (arg)
(semantic-tag-new-variable
(funcall arg-name-maker arg)
(getf arg :type)))
(malabar--get-arguments spec)))
:typemodifiers (mapcar #'symbol-name
(malabar--get-modifiers spec))))

(provide 'malabar-reflection)

;; Local Variables:
Expand Down

0 comments on commit e79d116

Please sign in to comment.