Giter Site home page Giter Site logo

emacs-tss's Introduction

Japanese

Build Status

What's this?

This is a extension of Emacs that provides completion/syntax-check by using typescript-tools in typescrript-mode.

About typescript-tools, see https://github.com/clausreinke/typescript-tools

Feature

Auto completion by auto-complete.el

demo1

Popup help by popup.el

demo2

Echo method signature by eldoc.el

eldoc

Check syntax by flymake.el

flymake

Jump to definition

Implement inherit definition

impl

Requirement

  • typescript-tools

Install

If use package.el

2013/09/10 It's available by using melpa.

If use el-get.el

2013/08/10 Not yet available.
2013/09/08 It's available. But, master branch only.

If use auto-install.el

(auto-install-from-url "https://raw.github.com/aki2o/emacs-tss/master/tss.el")
(auto-install-from-url "https://raw.github.com/aki2o/emacs-tss/master/typescript.el")
  • In this case, you need to install each of the following dependency.

Manually

Download tss.el and put it on your load-path.

  • In this case, you need to install each of the following dependency.

Dependency

  • auto-complete.el
  • json-mode.el
  • log4e.el
  • yaxception.el

About official TypeScript.el

The official site provides TypeScript.el for Emacs.
But the official Typescript.el has some trouble ( wrong syntax, have no hook ).
So, I have bundled typescript.el as modified version of the official TypeScript.el.

Modification from the official version

$ diff TypeScript.el typescript.el
66c66
< (declare-function ido-mode "ido" ())
---
> (declare-function ido-mode "ido")
486a487,491
> (defcustom typescript-mode-hook nil
>   "*Hook called by `typescript-mode'."
>   :type 'hook
>   :group 'typescript)
> 
3351c3356,3358
<     (font-lock-fontify-buffer)))
---
>     (font-lock-fontify-buffer))
> 
>   (run-mode-hooks 'typescript-mode-hook))
  • It maybe happen that update of the official version is not merged into typescript.el
  • The last date of checking merge is 2013/08/10

Configuration

;; If use bundled typescript.el,
(require 'typescript)
(add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-mode))

(require 'tss)

;; Key binding
(setq tss-popup-help-key "C-:")
(setq tss-jump-to-definition-key "C->")
(setq tss-implement-definition-key "C-c i")

;; Make config suit for you. About the config item, eval the following sexp.
;; (customize-group "tss")

;; Do setting recommemded configuration
(tss-config-default)

Consideration

Activation

If you meet the following condition, do not need to do anything.

  • use bundled typescript.el
  • use tss-config-default setting

Otherwise, need M-x tss-setup-current-buffer for activation in typescript-mode.

  • Not activate on the buffer of the mode not included in tss-enable-modes

Deactivation by trouble at typescript-tools

The function of this extension depends on typescript-tools.
And, typescript-tools may become impossible depending on the contents of the buffer.
If it happened, For avoiding Emacs performance degradation,
this extention is deactivated automatically and the following popup notification is shown.

alert

The above case is caused by the contents of the buffer.
So, typescript-tools maybe back to normal by activation after editing of the buffer.
If you want to activate this extension again, do M-x tss-restart-current-buffer.

Also, if you want to stop to use typescript-tools, do M-x tss-stop-current-buffer.

Reflection of the update of referenced path

You can get the external definition using /// <reference path ....
But typescript-tools can not find the update of that.
You have to do M-x tss-reload-current-project if you updated the external definition of current buffer.

Tested On

  • Emacs … GNU Emacs 23.3.1 (i386-mingw-nt5.1.2600) of 2011-08-15 on GNUPACK
  • typescript-tools … master branch
  • auto-complete.el … 1.4.0
  • json-mode.el … 1.1.0
  • log4e.el … 0.2.0
  • yaxception.el … 0.2.0

Enjoy!!!

emacs-tss's People

Contributors

aki2o avatar carltonf avatar gifnksm avatar jschaf avatar ozanmakes avatar stevenremot 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  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

emacs-tss's Issues

How to customize indentation?

Is there any way to customize indentation for typescript code. For example lets say I have such snippet of typescript with default indentation:

D.div({},
      D.span({}),
      D.span({})
     )

Is it possible to change it to something like:

D.div({},
  D.span({}),
  D.span({})
)

Slowness in TSS-Windows

Hi

I have setup a TSS plugin in emacs as per your instructions , but I find it extremely slow. Is this normal or am I missing something here

Can't import node module

So I have webpack drived project with this:

import * as $ from "jquery";
import "jquery.terminal";

$(function() {
    $('<div/>').appendTo('body').terminal(function(command: number) {
        
    });
});

but this give me error that it can't find jquery I have it installed and I have d.ts file in my root directory, I've also tried to install npm install --save-dev @types/jquery with no effect.

it should even work with import "jquery"; because d.ts file provide $ function.

I'm trying to get to the point where I get error about terminal function have number instead of string type, but I now have error that jquery cannot be found.

I have this tsconfig:

{
    "compilerOptions": {
        "lib": ["esnext", "dom"],
        "experimentalDecorators": true,
        "target": "es5",
        "moduleResolution": "Node",
        "allowJs": true
    }
}

How can I disable flymake mode?

I have a rather complicated typescript project setup and flymake is displaying errors that aren't any. How can I disable flymake mode in tss?

Support for company-mode?

It seems like company-mode is considered to be a better completion package than auto-complete. Would it be possible to add support for company-mode as well?

Use tsconfig.json if present in the current buffer's directory

Hello,

Currently tss is started with the current buffer's filename as argument. Starting with TS 1.5 and TSS 0.4, tss can read its configuration from a tsconfig.json file.

emacs-tss could look for that file and if present then use it. It would make it possible to pass arguments to tss like --module. I don't know anything about lisp or emacs' lisp API so I can't help on the implementation side.

Cheers
Daniel

Connection to TSS times out during auto-completion

Hi,

first of all thank you very much for writing this plugin!

I have the problem that the connection to the tss tools seems to time out during auto completion, this causes the buffer to hang every time auto completion is attempted.

Here is a snippet of what I believe is the relevant log
10:45:51 [DEBUG] Got candidate name[super] kind[builtin-keyword] type[]
10:45:55 [TRACE] start get ac member candidates.
10:45:55 [TRACE] Start get ac candidates. code[erson.]
10:45:55 [DEBUG] Start sync server : update 19 /home/pkoerbitz/dev/ts/hello_world/hello.ts
10:45:55 [TRACE] Start wait sync server.
10:45:56 [TRACE] Received server response.
"updated /home/pkoerbitz/dev/ts/hello_world/hello.ts, (2/1) errors"

10:45:58 [WARN ] Timeout sync server.
10:45:58 [TRACE] start get ac member candidates.
10:45:58 [TRACE] Start get ac candidates. code[]
10:45:58 [DEBUG] Start sync server : update 19 /home/pkoerbitz/dev/ts/hello_world/hello.ts
10:45:58 [TRACE] Start wait sync server.
10:45:58 [TRACE] Received server response.
"updated /home/pkoerbitz/dev/ts/hello_world/hello.ts, (2/1) errors"

10:46:01 [WARN ] Timeout sync server.

I am using emacs-tss 0.5.0 (through el-get) and tss 0.3.1 (through npm).

Code completion not working

I had to set up a new machine with 8.1 OS, I installed typescript, typescript tools and emacs-tss via package installer. I modified the .emacs as well accordingly. But I am not getting the completion pop-ups. When I open .ts file I can see that it is starting tss process.

[TSS] Load 'server.ts' ...
[TSS] Loaded 'server.ts'.
 [5 times]
Matching buffer contents... [2 times]
Computing completion candidates...

Below is my emacs config.

(load "~/.emacs.d/my-packages.el")
(set-face-attribute 'default nil :height 100)
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(cua-mode t nil (cua-base))
 '(custom-enabled-themes (quote (manoj-dark)))
 '(org-agenda-files (quote ("d:/SkyDrive/Documents/O-Diary.org")))
 '(send-mail-function (quote mailclient-send-it)))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )
(set-default-font "Consolas 10")
(setq org-log-done 'time)

(require 'helm)
(require 'helm-config)

;; The default "C-x c" is quite close to "C-x C-c", which quits Emacs.
;; Changed to "C-c h". Note: We must set "C-c h" globally, because we
;; cannot change `helm-command-prefix-key' once `helm-config' is loaded.
(global-set-key (kbd "C-c h") 'helm-command-prefix)
(global-unset-key (kbd "C-x c"))

(define-key helm-map (kbd "") 'helm-execute-persistent-action) ; rebind tab to run persistent action
(define-key helm-map (kbd "C-i") 'helm-execute-persistent-action) ; make TAB works in terminal
(define-key helm-map (kbd "C-z")  'helm-select-action) ; list actions using C-z

(when (executable-find "curl")
  (setq helm-google-suggest-use-curl-p t))

(setq helm-split-window-in-side-p           t ; open helm buffer inside current window, not occupy whole other window
      helm-move-to-line-cycle-in-source     t ; move to end or beginning of source when reaching top or bottom of source.
      helm-ff-search-library-in-sexp        t ; search for library in `require' and `declare-function' sexp.
      helm-scroll-amount                    8 ; scroll 8 lines other window using M-/M-
      helm-ff-file-name-history-use-recentf t)

(helm-mode 1)
;; dirty fix for having AC everywhere
(define-globalized-minor-mode real-global-auto-complete-mode
  auto-complete-mode (lambda ()
                       (if (not (minibufferp (current-buffer)))
                         (auto-complete-mode 1))
                       ))
(real-global-auto-complete-mode t)

(add-to-list 'exec-path "C:/Program Files (x86)/Aspell/bin/")
(setq ispell-program-name "aspell")
(setq ispell-personal-dictionary "D:/OneDrive/Documents/.ispell")
(require 'ispell)
(global-set-key (kbd "") 'ispell-word)
(global-set-key (kbd "C-") 'flyspell-mode)

(recentf-mode 1) ; keep a list of recently opened files
(global-set-key (kbd "") 'recentf-open-files)
(require 'ido)
(ido-mode t)
(icy-mode 1)

(require 'uniquify)
(setq uniquify-buffer-name-style 'forward)

(require 'saveplace)
(setq-default save-place t)
(global-set-key (kbd "M-/") 'hippie-expand)
(global-set-key (kbd "C-x C-b") 'ibuffer)
(global-set-key (kbd "M-z") 'zap-up-to-char)

(global-set-key (kbd "C-s") 'isearch-forward-regexp)
(global-set-key (kbd "C-r") 'isearch-backward-regexp)
(global-set-key (kbd "C-M-s") 'isearch-forward)
(global-set-key (kbd "C-M-r") 'isearch-backward)

(show-paren-mode 1)
  (setq-default indent-tabs-mode nil)
  (setq x-select-enable-clipboard t
        x-select-enable-primary t
        save-interprogram-paste-before-kill t
        apropos-do-all t
        mouse-yank-at-point t
        require-final-newline t
        visible-bell t
        ediff-window-setup-function 'ediff-setup-windows-plain
        save-place-file (concat user-emacs-directory "places")
        backup-directory-alist `(("." . ,(concat user-emacs-directory
                                                 "backups"))))

;; If use bundled typescript.el,
(require 'typescript)
(add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-mode))

(require 'tss)

;; Key binding
(setq tss-popup-help-key "C-:")
(setq tss-jump-to-definition-key "C->")
(setq tss-implement-definition-key "C-c i")

;; Make config suit for you. About the config item, eval the following sexp.
;; (customize-group "tss")

;; Do setting recommemded configuration
(tss-config-default)

What is typescripton?

Do you know what the package typescripton is? I can't find it on Melpa or el-get or Google.

How can I disable auto-complete-mode?

Thanks for all the work you put in tss. I have a small problem though. I was trying to programmatically disable auto-complete-mode in the typescript-mode-hook but couldn't.
How can I achieve this?

JSON response reception stops too early

Hi,

my emacs freezes for some minutes in this scenario:

class C {
    private _person: string;

    public get person(): string {
        var node = new // <<< write a space here
    }

    public set person(person: string) {
        this._person = person;
    }
}

(OK, this code makes no sense, but I was just testing)

Here is the log: https://gist.github.com/stevenremot/7535583
A part of the response ended with "}", but it wasn't the closing brace of the whole message. I modified the response treatment in my repository by asserting response is full only when braces are balanced, which should be more robust than checking the last received character.

I tested my modifications and added a unit test too, it's all green, so if you approve this method, I can make a pull request.

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.