GitXplorerGitXplorer
J

po-language-server

public
11 stars
1 forks
0 issues

Commits

List of commits on branch main.
Unverified
ecf066b4d673f14de6858f588384aa127b45ed45

Bump version.

JJulienPalard committed 4 years ago
Verified
ea469e2dca720cfea082cc6aeec7c2fce56146aa

Merge pull request #3 from dmerejkowsky/fix-binary-name

JJulienPalard committed 4 years ago
Unverified
3b3bc116e95e960dca633b7b21d3cadef90ba66a

setup.cfg: fix binary name

ddmerejkowsky committed 4 years ago
Unverified
342db39a9409485aabbdfd0372f4ce525bdc1f0e

More infos in the README.

JJulienPalard committed 4 years ago
Unverified
0c48324c2d2316621616671ffbab270c5943d690

Packaging it.

JJulienPalard committed 4 years ago
Unverified
495c3e0a4ad3359f3072c9a0d1674b06b9457f75

Add README, remove unrelevant classifiers.

JJulienPalard committed 4 years ago

README

The README file for this repository.

po-language-server

This is a Markov-chain based completion language server for gettext po files.

Installation

python3 -m pip install po-language-server

It should be compatible with vim, emacs, vscode, and other text editors acting as language server clients. I only tried it using emacs though.

Emacs configuration

I did not packaged it yet (feel free to help), but it's not that hard to configure:

(require 'lsp-mode)

(add-to-list 'lsp-language-id-configuration '(po-mode . "gettext"))

(lsp-register-client
 (make-lsp-client
  :new-connection (lsp-stdio-connection "po-language-server")
  :activation-fn (lsp-activate-on "gettext" "plaintext")
  :priority -1
  :server-id 'po
))
(add-hook 'po-mode-hook #'lsp)

;; lsp-mode can only work on named buffers
(defun po-mode-name-buffer ()
  (setq-local buffer-file-name "msgstr.po")
  (lsp))

(defun po-mode-unname-buffer ()
  (setq-local buffer-file-name nil))

(add-hook 'po-mode-hook
 (lambda ()
   (advice-add 'po-edit-msgstr :after 'po-mode-name-buffer)
   (advice-add 'po-subedit-exit :before 'po-mode-unname-buffer)))

(add-to-list 'lsp-enabled-clients 'po)