Skip to main content

Emacs Pulumi LSP

Install Pulumi Emacs Mode

The source code is on https://github.com/pulumi/pulumi-lsp. At the very bottom of the page are the instructions on how to install. You Need to have make installed.

$ make install emacs-client
mkdir -p ./bin
go build -ldflags "-X github.com/pulumi/pulumi-lsp/sdk/version.Version=v0.2.3-6-gec49054" -o ./bin -p 10 ./cmd/...
go: downloading github.com/pulumi/pulumi/sdk/v3 v3.53.1
...
...
...
go install -ldflags "-X github.com/pulumi/pulumi-lsp/sdk/version.Version=v0.2.3-6-gec49054" ./cmd/...
mkdir -p editors/emacs/bin
cd editors/emacs && emacs -Q --batch --eval "(progn (setq package-user-dir \"$(pwd)/bin\" \
                                                          package-archives '((\"melpa\" . \"https://melpa.org/packages/\") \
                                                                           (\"gnu\" . \"https://elpa.gnu.org/packages/\"))) \
											    (package-initialize) \
                                                    (package-install 'yaml-mode) (package-install 'lsp-mode))" -f batch-byte-compile pulumi-yaml.el
Contacting host: melpa.org:443
  INFO     Scraping files for yaml-mode-autoloads.el...done
Checking /home/mihamina/.emacs.d/pulumi-lsp/editors/emacs/bin/yaml-mode-20230329.723...
Package ‘yaml-mode’ installed.
Setting ‘package-selected-packages’ temporarily since "emacs -q" would overwrite customizations
Contacting host: melpa.org:443
  INFO     Scraping files for lv-autoloads.el...done
Checking /home/mihamina/.emacs.d/pulumi-lsp/editors/emacs/bin/lv-20200507.1518...
Contacting host: melpa.org:443
  INFO     Scraping files for markdown-mode-autoloads.el...done
Checking /home/mihamina/.emacs.d/pulumi-lsp/editors/emacs/bin/markdown-mode-20230412.126...
  INFO     Scraping files for spinner-autoloads.el...done
Checking /home/mihamina/.emacs.d/pulumi-lsp/editors/emacs/bin/spinner-1.7.4...
Contacting host: melpa.org:443
Parsing tar file...done
Extracting...done
  INFO     Scraping files for dash-autoloads.el...done
Checking /home/mihamina/.emacs.d/pulumi-lsp/editors/emacs/bin/dash-20230415.2324...
Contacting host: melpa.org:443
  INFO     Scraping files for ht-autoloads.el... 
ht:0: Warning: Not registering prefix "ht".
  INFO     Scraping files for ht-autoloads.el...done
Checking /home/mihamina/.emacs.d/pulumi-lsp/editors/emacs/bin/ht-20230214.1632...
Contacting host: melpa.org:443
  INFO     Scraping files for s-autoloads.el...done
Checking /home/mihamina/.emacs.d/pulumi-lsp/editors/emacs/bin/s-20220902.1511...
Contacting host: melpa.org:443
Parsing tar file...done
Extracting...done
  INFO     Scraping files for f-autoloads.el...done
Checking /home/mihamina/.emacs.d/pulumi-lsp/editors/emacs/bin/f-20230116.1032...
Contacting host: melpa.org:443
Parsing tar file...done
Extracting...done
  INFO     Scraping files for lsp-mode-autoloads.el...done
Checking /home/mihamina/.emacs.d/pulumi-lsp/editors/emacs/bin/lsp-mode-20230418.1027...
...
...
...
Package ‘lsp-mode’ installed.

In toplevel form:
pulumi-yaml.el:105:44: Warning: reference to free variable
    ‘pulumi-yaml-store-path’
pulumi-yaml.el:113:17: Warning: reference to free variable
    ‘eglot-server-programs’
pulumi-yaml.el:113:17: Warning: assignment to free variable
    ‘eglot-server-programs’
mkdir -p ./bin
cp editors/emacs/pulumi-yaml.elc bin/
            

The installation is done. We need to configure Emacs to use it. In case of upgrade, run make clean before make emacs-client

Configure Emacs

In order to configure Emacs to use it, we need to instruct Emacs about the path of the mode, and require it.
This configuration section has been updated after some reader comments

(add-to-list 'load-path "/home/mihamina/.emacs.d/pulumi-lsp/bin")
(require 'pulumi-yaml)
(require 'lsp-mode)
(add-to-list 'auto-mode-alist '("Pulumi.*\\.yaml\\'" . pulumi-yaml-mode))
(add-to-list 'auto-mode-alist '("Pulumi.*\\.yml\\'" . pulumi-yaml-mode))
(add-hook 'pulumi-yaml-mode-hook #'lsp-mode)
            

You have noticed I added the path of the elc file, which has been copied there by the previous compilation.

When you first open a Pulumi YAML file, it will load the Pulumi mode, but without the LSP server enabled.
In order to run the Pulumi LSP, M-x lsp.
This will prompt about the LSP server to use: the only choice will be pulumi-lsp, choose it.

Popular posts from this blog

npm run build base-href

Using NPM to specify base-href When building an Angular application, people usually use "ng" and pass arguments to that invocation. Typically, when wanting to hard code "base-href" in "index.html", one will issue: ng build --base-href='https://ngx.rktmb.org/foo' I used to build my angular apps through Bamboo or Jenkins and they have a "npm" plugin. I got the habit to build the application with "npm run build" before deploying it. But the development team once asked me to set the "--base-href='https://ngx.rktmb.org/foo'" parameter. npm run build --base-href='https://ngx.rktmb.org/foo did not set the base href in indext.html After looking for a while, I found https://github.com/angular/angular-cli/issues/13560 where it says: You need to use −− to pass arguments to npm scripts. This did the job! The command to issue is then: npm run build -- --base-href='https://ngx.rktmb.org/foo...

wget maven ntlm proxy

How to make wget, curl and Maven download behind an NTLM Proxy Working on CentOS, behind an NTLM proxy: yum can deal without problem with a NTLM Proxy wget, curl and Maven cannot The solution is to use " cntlm ". " cntlm " is a NTLM client for proxies requiring NTLM authentication. How it works Install "cntlm" Configure "cntlm"  by giving it your credentials by giving it the NTLM Proxy Start "cntlm" deamon (it listens to "127.0.0.1:3128") Configure wget, curl and Maven to use "cntlm" instead of using directly the NTLM Proxy Note: You will have then a kind of 2 stages Proxy : cntlm + the NTLM proxy Configure CNTLM After installing cntlm, the configuration file is in "cntlm.conf". You must have your domain (in the Windows meaning), proxy login and  proxy password. Mine are respectively: rktmb.org, mihamina, 1234abcd (yes, just for the example) You must have you NTLM Proxy Hostnama or IP ...

VMWare Keyboard Latency

Workstation VM UI lag when typing When using a VMWare Workstation VM, I noticed there is a latency when typing in the keyboard and the real appearance of the typed character. I searched and found: Noticeable typing lag in Linux VM terminals since v16.2 upgrade on Linux host To make it short, what solved it for me: Disable 3D acceleration in the VM setting .