AdamNiederer / ng2-mode

Angular Support for Emacs
GNU General Public License v3.0
73 stars 11 forks source link

Jump to definition of variable used in template? #6

Closed rtm closed 5 years ago

rtm commented 6 years ago

I'd love to have a feature like Tide's C-. for jumping to the definition of a symbol used in a template. It would also be lovely to be able to jump to a template/custom element definition from a template. Finally, it would be superb to do JS syntax checking in expressions used in templates.

Anyway, thanks for this tool.

pivaldi commented 6 years ago

Did you try M-x ng2-html-goto-binding which is bound to C-c b ?

Unfortunately, this function seems buggy… Here the buffer diff which works well for me :

diff -u --label /home/pi/emacs.d/site-lisp/melpa/ng2-mode-20180206.1128/ng2-ts.el --label \#\<buffer\ ng2-ts.el\> /home/pi/emacs.d/site-lisp/melpa/ng2-mode-20180206.1128/ng2-ts.el /tmp/buffer-content-20779gux
--- /home/pi/emacs.d/site-lisp/melpa/ng2-mode-20180206.1128/ng2-ts.el
+++ #<buffer ng2-ts.el>
@@ -76,7 +76,7 @@
 (defun ng2-ts-goto-fn (fn-name)
   "Places the point on the function called FN-NAME."
   (goto-char (point-min))
-  (search-forward-regexp (format "\\(\\%s\\)\(.*\).*{" fn-name)))
+  (search-forward-regexp (format "\\(%s\\)\(.*\).*{" fn-name)))

 (defvar ng2-ts-mode-map
   (let ((map (make-keymap)))

In other words, in the file ng2-mode-XXXXXX/ng2-ts.el, change the line (search-forward-regexp (format "\\(\\%s\\)\(.*\).*{" fn-name))) to (search-forward-regexp (format "\\(%s\\)\(.*\).*{" fn-name)))

Save the buffer, recompile the file with M-x byte-recompile-file and restart Emacs.

Waiting for bug fix in the next release…

rtm commented 5 years ago

@pivaldi Thanks, but that gives me

Symbol's function definition is void: ng2-open-counterpart