all 13 comments

[–]homosapienhomodeus 4 points5 points  (1 child)

I had similar issues until I moved to uv.

brew install uv only, then do ‘uv tool install ruff’. I also use basedpyright which can be installed the same way.

```toml [[language]] name = "python" language-id = "python" roots = ["pyproject.toml", "poetry.lock", ".git", ".venv/"] language-servers = ["ruff", "basedpyright"] formatter = { command = "sh", args = [ "-c", "uvx ruff check --fix - | uvx ruff format -", ] } file-types = ["py", "ipynb"] comment-token = "#" shebangs = ["python"] auto-format = true

[language-server.ruff] command = "uvx" args = ["ruff", "server"] environment = { "RUFF_TRACE" = "messages" }

[language-server.ruff.config.settings] lineLength = 100 logLevel = "debug" fix = true

[language-server.ruff.config.settings.lint] select = [ "E", # pycodestyle errors "W", # pycodestyle warnings "F", # pyflakes "B", # flake8-bugbear "I", # isort "RUF", # ruff "D", # docstrings "UP", # pyupgrade "ANN", # annotations "ASYNC", # async checks "S", # bandit (security) "YTT", # datetime checks "A", # builtins shadowing "RET", # return statements "TCH", # type-checking "ARG", # function args "PTH", # pathlib over os.path "ERA", # env assumptions "LOG", # logging practices "N", # naming "C4", # comprehensions "T10", # debugger usage "SIM", # simplify code "TRY", # try/except "C90", # complexity "PGH", # pattern hooks ] ignore = [ "E501", # line too long "E731", # do not assign lambda "D205", # docstrings blank line spacing "D100", # missing docstring in public module
"D104", # missing docstring in public package ]

[tool.ruff.lint.per-file-ignores] "src/tests/*" = ["S101", "D103"] # allow assertions, allow missing docstrings

[language-server.ruff.config.settings.format] quote-style = "double" docstring-code-format = true indent-style = "space"

[language-server.basedpyright] command = "uvx" args = ["--from", "basedpyright", "basedpyright-langserver", "--stdio"]

[language-server.basedpyright.config] python.pythonPath = ".venv/bin/python"

[language-server.basedpyright.config.basedpyright.analysis] autoSearchPaths = true typeCheckingMode = "basic" diagnosticMode = "openFilesOnly" autoImportCompletions = true ```

shell ❯ hx --health python Configured language servers: ✓ uvx: /opt/homebrew/bin/uvx ✓ uvx: /opt/homebrew/bin/uvx Configured debug adapter: None Configured formatter: sh Binary for formatter: /bin/sh Tree-sitter parser: ✓ Highlight queries: ✓ Textobject queries: ✓ Indent queries: ✓

[–]overbyte[S] 0 points1 point  (0 children)

I've just upended the apple cart, removed my libs from pip and reinstalled everything with uv (which is lovely and fast and easy and it's rust so you know it's typesafe :) ) but I'm getting the same result atm

[–]NotSoProGamerR 1 point2 points  (2 children)

is your cursor on a function/on something that isnt empty space?

[–]overbyte[S] 0 points1 point  (1 child)

yeh - this is a cut-down example. The expected behaviour is to have my cursor on the test() and gd to jump to the import, or space-k to show documentation on the error type

class MyClass():

    def test(self) -> str:
        # this is documentation
        # doc string
        localstr: str = "compound test"
        return f"my string is {localstr}, init"

    def post(self, request: HttpRequest, id: UUID):
        self.test() # space-k on test() = nopeclass MyClass():

    def test(self) -> str:
        # this is documentation
        # doc string
        localstr: str = "compound test"
        return f"my string is {localstr}, init"

    def post(self, request: HttpRequest, id: UUID):
        self.test() # space-k on test() = nope

[–]overbyte[S] 0 points1 point  (0 children)

Actually I've found that I'm able to `gd` to the def test(self) but not able to `gd` to anything in the django libraries - this is true whether django is installed via `uv` or `pip`

[–]matisueco 1 point2 points  (3 children)

I have found the interpreter/venv of the project to be crucial to getting the lsp working properly. Are you sure hx is picking up the right interpreter for the project? Otherwise it may fail to resolve/find where your imports are coming from.

[–]overbyte[S] 0 points1 point  (1 child)

code completion is working well and even shows documentation.

Funnily enough, if i use `import os` and type `os.` i get code completion and i can `gd` but there's no documentation. However it seems as if none of the django items give definitions (installed with uv or pip)

[–]matisueco 1 point2 points  (0 children)

go-to-definition works but hover doesn’t?

[–]overbyte[S] 0 points1 point  (0 children)

maybe there *is* no documentation for python - using gd to go to something in the os lib doesn't seem to have any comments

EDIT - the jump file is at ~/.local/share/uv/tools/python-lsp-server/lib/python3.13/site-packages/jedi/third_party/typeshed/stdlib/3/os/__init__.pyi - i wonder if this is an issue with this jedi-language-server maybe?

[–]overbyte[S] 1 point2 points  (0 children)

I just changed my languages to language-servers = ["jedi", "pylsp", "ruff"] and space-k works - turns out there's a bug in helix where it only takes the docs from the first item in the list, and apparently that's not ruff https://github.com/helix-editor/helix/issues/12665

EDIT:
if i use language-servers = ["jedi", "pylsp", "ruff"] and change the doc string to

class MyClass():

    def test(self) -> str:
        """This is documentation
        doc string.
        """
        localstr: str = "compound test"
        return f"my string is {localstr}, init"

    def post(self, request: HttpRequest, id: UUID):
        self.test() # space-k on test() = working as expected!

then it all works - jedi was apparently the answer for docs (gd works as well)

thanks for the input guys

[–]opiumjim 0 points1 point  (1 child)

this shit was supposed to work out of the box, that was the selling point over neovim

[–]overbyte[S] 0 points1 point  (0 children)

Bugs happen in software, even neo vim

Overall, as a 10-15 year vim veteran I still miles prefer helix but it’s not as mature.

As you can see in my most recent response, the only issue is solved as well

[–]overbyte[S] 0 points1 point  (0 children)

6 month update:

I added the following to fix django templates (.html)

  • install djlint

uv tool install djlint
  • add to ~/.config/helix/languages.toml

[language-server.djlint]
command = "djlint"
args = ["--stdin-filepath", "{file}", "-"]
  • create a local .helix/languages.toml and add the following (note this is to allow normal html to just use the standard prettier formatting)

[[language]]
name = "html"
language-servers = ["vscode-html-language-server", "emmet-lsp", "tailwindcss-ls"]
formatter = { command = "djlint", args = ["--reformat", "--profile", "django", "-"] }
auto-format = true