Giter Club home page Giter Club logo

ng2-mode's Introduction

GPLv3 MELPA

ng2-mode

The Angular 2+ support Emacs needs

Screenshot

Features

Dependencies

Installation

Install this package with M-x package-install RET ng2-mode. It will automatically be activated on *.{component|service|pipe|directive|guard|module}.ts and *.component.html files, as well as whenever you type M-x ng2-mode.

If you want lsp-mode integration for your typescript files, add this to ~/.emacs.d/init.el:

(with-eval-after-load 'typescript-mode (add-hook 'typescript-mode-hook #'lsp))

Functions

  • ng2-mode - Enable either ng2-ts-mode or ng2-html-mode, depending on the buffer's file extension
  • ng2-ts-mode - Enable Angular 2 TypeScript mode
  • ng2-html-mode - Enable Angular 2 Template mode

Contributing

If you want to see a function in either mode, feel free to open an issue or a pull request.

License

GPLv3+

ng2-mode's People

Contributors

adamniederer avatar cliffordthompson avatar llinksrechts avatar ollelinderos avatar purcell avatar sgarciac avatar solkaz avatar syohex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ng2-mode's Issues

set indentation to 2

It seems the current indentation level is set to 4. How do I set it to 2? Customize seems to show a default of 2, but I get a default of 4. I'm using prelude. Don't know if that makes any difference.

Lambda type in Lambda argument causes infinite loop

Code such as:

(f: (s) => boolean) => f

will cause ng2-mode's ng2-ts--highlight-lambda-args-fn to enter an infinite loop.

Initially I think this is due to ng2-ts--inside-lambda-args-p finding the first => and not the lambda's own =>

I am working on a patch and will post an update with it as soon as I can.

ng2-html-goto-binding doesn't work with name$

When using the common Angular convention of appending observable variables with a dollar sign (e.g. name$), ng2-html-goto-binding breaks with the error:
"Couldn't find name$"

I'm guessing that the dollar sign needs to be escaped to be treated as a regular character in the regexp?

emacs theme in screenshot

Hello @AdamNiederer! Sorry for creating a post here, wasn't sure how I can reach you. I was wondering if you know what emacs theme was used in the screenshots? Much appreciated :)

type-script keymap does not appear to be inherited

typescript-insert-and-indent does not seem to be called in ng2-ts-mode
I'm not sure this is the right way to correct,
but when I renamed ng2-ts-map to ng2-ts-mode-map, and deleted the (use-local-map ng2-ts-map) from
ng2-ts.el, then I get the "correct" behavior

Support more decorators

Any reason the current list of decorators is hardcoded to a select few? There are way more decorators that come into everyday use, (@Injectable, @Input, @Output, @ContentChild, @ViewChild, etc).

Should this be based on a regex?

Jump to definition of variable used in template?

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.

Angle bracket (>) seems to cause 100% cpu.

Problem

While following along with this tutorial ng2-ts mode seems to cause emacs to block and use 100% of the CPU. The code in question is from the "Error handling" section, specifically:

private handleError<T> (operation = 'operation', result?: T) {
  return (error: any): Observable<T> => {  // Typing the second > on this line causes the issue.
     // ...
  };
}

Environment

  • MacOS 10.14.6
  • iTerm2 Build 3.3.7
  • Angular CLI: 8.3.20
  • Node: 12.13.1
  • Angular: 8.2.14
  • Emacs 26.3

Emacs configuration

 ;; Angular/Typescript
 (use-package typescript-mode
    :ensure t)
 
 (use-package ng2-mode
    :ensure t
    :after typescript-mode)

Steps to reproduce

  1. ng new repro Accept defaults.
  2. cd repro
  3. Launch emacs and open repro/src/app/app.module.ts
  4. In the AppModule class, add the following block
getRepro() {
  return (): <T> => {
  }
}
  1. Typing the second gt bracket (>) will reproduce the issue.

Misc.

  • The issue does not happen with only typescript-mode enabled.
  • Once the offending block of code is in the file, emacs will hang when attempting to open the file.
  • Emacs does not recover. SIGKILL is the only option.

Configurable file names

I'm working in a project in which naming is different from what ng2 expects:

  • home.component.ts
  • home.template.html

It would be nice to have an option to configure it to specific needs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.