Giter VIP home page Giter VIP logo

emacs-k8s-mode's Issues

Yasnippet templates not loading automatically

Reproduction steps

  • Using a fresh debian/testing64 machine (I used Vagrant: vagrant up debian/testing64 + vagrant ssh)
  • Install emacs-nox package: sudo apt update && sudo apt install -y --no-install-recommends emacs-nox
  • Launch emacs
  • Load the following bootstrap script to set up basic env
; Enable MELPA and more
(setq package-archives
      '(("Gnu" . "https://elpa.gnu.org/packages/")
       ;("marmalade" . "https://marmalade-repo.org/packages/")
        ("Melpa" . "https://melpa.org/packages/")
        ("Org" . "https://orgmode.org/elpa/"))
      package-archive-priorities
      '(("Org"    . 10)
        ("Melpa"  . 5)
        ("Gnu"    . 0)))

; Bootstrap use-package library 
(if (not (locate-library "use-package"))
    (progn
      (package-refresh-contents)
      (package-install 'use-package)))

(require 'use-package)

; Force-install missing packages
(setq use-package-always-ensure t)

; Load yasnippet for our purposes
(use-package yasnippet
  :diminish yas-minor-mode
  :config
  ;; Fix indentation of snippets in yaml
  ;; https://github.com/joaotavora/yasnippet/issues/1020#issuecomment-539787929
  (add-hook 'yaml-mode-hook
          '(lambda () (set (make-local-variable 'yas-indent-line) 'fixed)))
  (yas-global-mode 1))


; Now install/load k8s-mode as a normal user would
(use-package k8s-mode)
  • Open a kubernetes related yaml file (I used kubernetes-in-action book samples, as I'm still learning k8s)
  • M-x k8s-mode to switch mode
  • Type pod<TAB>
  • Witness no completion happen
  • Confirm via (yas-describe-tables) not showing any k8s related entries

Expected behaviour

On M-x k8s-mode, typing pod<TAB> should complete, as should
(yas-describe-tables) show k8s-related snippets.

Workaround

As a user, forcing loading the directory on mode enter

;; Force loading the k8s-snip-dir on k8s-mode loading
(use-package k8s-mode
  :config (add-hook 'k8s-mode-hook
		    (lambda () (yas-load-directory k8s-snip-dir))))

Some thoughts

I am not an elisp master, sorry, so I don't know what magic is missing, but I'm forced to accept that the snippet-loading script of

(eval-after-load 'yasnippet
is not sufficient.

I searched my existing packages for such snippet-loading, and best I found was ansible (Github package), which does work on my machine, and uses a more complicated system I don't fully understand (a concern on unloading snippets, perhaps?)

I'd recommend trying to remove the eval-after-load at module load, keeping an on-mode-enter (when (featurep 'yasnippet) to do the right thing.

Good luck, and thanks for sharing the module!

<tab> or <return> error

When I edit a kubernetes yaml and hit <tab> or <return> keys within any indented region I get this error:

funcall-interactively: Wrong type argument: number-or-marker-p, nil

Emacs version 25.2.2.

Completion in k8s files

Do you know of a way to get completion added? I would be willing to add some for this mode, but I do not know where I would find the keywords for kubernetes files. Also do you plan to do anything with Helm in the future?

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.