Snippets

Mihamina Rakotomandimby Emacs for Angular

Created by Mihamina Rakotomandimby
(setq inhibit-startup-message t)
(setq initial-scratch-message nil)
;;(toggle-frame-maximized)
(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.
 '(meghanada-auto-start t)
 '(meghanada-debug t)
 '(meghanada-full-text-search-enable t)
 '(package-selected-packages (quote (yasnippet))))

(add-to-list 'load-path "/data/home/vertx/Dev/emacs/use-package-master")
(eval-when-compile
  (add-to-list 'load-path "/data/home/vertx/Dev/emacs/use-package-master")
  (require 'use-package))

(require 'use-package)
(package-initialize)

(set-default 'truncate-lines t)
;; ensure utf-8
(set-language-environment "UTF-8")
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
(transient-mark-mode)
(show-paren-mode 1)
(setq font-lock-maximum-decoration t)
(setq-default indent-tabs-mode nil)
(setq tab-width 4) 
(setq c-basic-offset 4)

(add-to-list 'load-path "/data/home/vertx/Dev/emacs/dash.el-master")
(add-to-list 'load-path "/data/home/vertx/Dev/emacs/yasnippet-master")
(add-to-list 'load-path "/data/home/vertx/Dev/emacs/typescript.el-master")
(add-to-list 'load-path "/data/home/vertx/Dev/emacs/tide-master")
(add-to-list 'load-path "/data/home/vertx/Dev/emacs/s.el-master")
(add-to-list 'load-path "/data/home/vertx/Dev/emacs/f.el-master")
(add-to-list 'load-path "/data/home/vertx/Dev/emacs/lsp-mode-master")
(add-to-list 'load-path "/data/home/vertx/Dev/emacs/lsp-ui-master")
(add-to-list 'load-path "/data/home/vertx/Dev/emacs/company-lsp-master")
(add-to-list 'load-path "/data/home/vertx/Dev/emacs/ht.el-master")
(add-to-list 'load-path "/data/home/vertx/Dev/emacs/company-mode-master")
(add-to-list 'load-path "/data/home/vertx/Dev/emacs/flycheck-master")
(add-to-list 'load-path "/data/home/vertx/Dev/emacs/meghanada-emacs-master")
(add-to-list 'load-path "/data/home/vertx/Dev/emacs/smartparens-master")
(add-to-list 'load-path "/data/home/vertx/Dev/emacs/highlight-indentation-for-emacs-master")
(add-to-list 'load-path "/data/home/vertx/Dev/emacs/web-mode-master")
(add-to-list 'load-path "/data/home/vertx/Dev/emacs/spinner.el-master")
(add-to-list 'load-path "/data/home/vertx/Dev/emacs/markdown-mode-master")

(require 'highlight-indentation)
(require 'yasnippet)
(require 'f)
(require 's)
(require 'ht)
(require 'company)
(require 'flycheck)
(require 'meghanada)
(require 'typescript-mode)
(require 'tide)
(require 'web-mode)
(require 'lsp-mode)
(require 'lsp-ui)
(require 'company-lsp)
(require 'smartparens)

(smartparens-global-mode 1)

(add-hook 'lsp-mode-hook 'lsp-ui-mode)
(add-hook 'typescript-mode-hook 'flycheck-mode)
(push 'company-lsp company-backends)

(setq indent-tabs-mode nil)
(setq tab-width 4)
(setq c-basic-offset 4)


(defun setup-tide-mode ()
  (interactive)
  (tide-setup)
  (flycheck-mode +1)
  (setq flycheck-check-syntax-automatically '(save mode-enabled))
  (setq tide-sync-request-timeout 3600)
  (setq tide-user-preferences '(:includeCompletionsForModuleExports t :includeCompletionsWithInsertText t :allowTextChangesInNewFiles t))
  ;; (setq tide-tsserver-executable "/data/home/vertx/Dev/b2b-selfcare-ngx-admin/node_modules/typescript/bin/tsserver")
  (setq tide-node-executable "/data/home/vertx/SDK/node-v10.15.3-linux-x64/bin/node")
  (setq tide-completion-ignore-case t)
  (setq tide-completion-enable-autoimport-suggestions t)
  (setq tide-completion-detailed t)
  (setq tide-disable-suggestions nil)
  (setq tide-tsserver-process-environment '("TSS_LOG=-level verbose -file /tmp/tss.log"))
  (flycheck-add-mode 'typescript-tslint 'typescript-mode)
  (flycheck-add-next-checker 'typescript-tslint 'javascript-tide 'append)
  (eldoc-mode +1)
  (tide-hl-identifier-mode +1)
  (company-mode +1)
  (setq company-tooltip-align-annotations t)
)

;;(setup-tide-mode)

(add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-mode))
(add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.css\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.css\\'" . web-mode))

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

;; formats the buffer before saving
;; (add-hook 'before-save-hook 'tide-format-before-save)
(add-hook 'typescript-mode-hook #'setup-tide-mode)

(add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-mode))
(add-hook 'web-mode-hook
          (lambda ()
            (when (string-equal "tsx" (file-name-extension buffer-file-name))
              (setup-tide-mode))))

(use-package tide
  :after (typescript-mode company flycheck)
  :hook ((typescript-mode . tide-setup)
         (typescript-mode . tide-hl-identifier-mode)
         (before-save . tide-format-before-save)))

(use-package yasnippet
  :defer 30
  :config
  (yas-global-mode t)
  (highlight-indentation-mode t)  
  (setq yas-fallback-behavior 'indent-line
        yas-snippet-dirs '("~/.emacs.d/snippets/angular/")))


(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.
 )

Comments (0)