GithubHelp home page GithubHelp logo

Comments (6)

ejuarezg avatar ejuarezg commented on May 22, 2024 1

Thank you so much, @abougouffa !

I was able to use your code to load two different files for the same language.

(setq lsp-ltex-dictionary
      `(:en-US ; English
        ,(vconcat
          (string-lines
           (with-temp-buffer
             (insert-file-contents "path/to/your/custom/dictionary.english.txt")
             (buffer-string)))
          (string-lines
           (with-temp-buffer
             (insert-file-contents "path/to/another/custom/dictionary.english.txt")
             (buffer-string))))))

For anyone else reading this, note that the file names can be anything. You can even use a ~ in the file path.

from lsp-ltex.

abougouffa avatar abougouffa commented on May 22, 2024

Hello @JoeyEremondi,

I've just commented on the original issue #4 (comment)

Do you have any idea?

from lsp-ltex.

ejuarezg avatar ejuarezg commented on May 22, 2024

Has anyone figured out how to read from a file? Or has this feature not been implemented yet? Just curious to know its state.

from lsp-ltex.

jcs090218 avatar jcs090218 commented on May 22, 2024

It's implemented in #26. Closing this issue now. ;)

from lsp-ltex.

ejuarezg avatar ejuarezg commented on May 22, 2024

Since I'm not too familiar with emacs configuration, how would I go about adding a file as a dictionary? The file contains a single word per line.

from lsp-ltex.

abougouffa avatar abougouffa commented on May 22, 2024

@ejuarezg

Theoretically, we can use such a file as a dictionary by setting the lsp-ltex-dictionary to the language and the file name, something like this:

(setq lsp-ltex-dictionary
      '(:fr [":/home/hacko/.config/emacs/ltex-dict.french.txt"]
        :en [":/home/hacko/.config/emacs/ltex-dict.english.txt"]
        :ar [":/home/hacko/.config/emacs/ltex-dict.arabic.txt"]))

However, the last time I've tested this it wasn't working, I think it is a problem in the upstream ltex-ls, but I didn't figure out the real cause of the problem (see #4 (comment)).

You can also set the list of words to add to the directory by modifying the lsp-ltex-dictionary value using for example:

(setq lsp-ltex-dictionary
      '(:fr ["coplanarité" "neuromorphique"] :en ["photometrically" "neuromorphic"]))

Currently, lsp-ltex provide a workaround for adding words to a custom directory (via code actions -> Add "word" to dictionary"). However, the used format is not a text file with a word per line, but rather, an Emacs Lisp file representing the value of lsp-ltex-dictionary, following the same format as the code above:

(:fr ["coplanarité" "neuromorphique"] :en ["photometrically" "neuromorphic"])

As a workaround, you can probably load the directory file elements and use it in the lsp-ltex-directory variable, using for example:

(setq lsp-ltex-dictionary
      `(:en ; English
        ,(vconcat
          (string-lines
           (with-temp-buffer
             (insert-file-contents "path/to/your/custom/dictionary.english.txt")
             (buffer-string))))
        :fr ; French
        ,(vconcat
          (string-lines
           (with-temp-buffer
             (insert-file-contents "path/to/your/custom/dictionary.french.txt")
             (buffer-string))))))

I hope this answers your question!

from lsp-ltex.

Related Issues (20)

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.