harish,
@harish@hachyderm.io avatar

Is there an #Emacs user out there who is using a fairly modern environment (e.g. eglot, tree-sitter, company) for Python development?

Could I ask how you do this? Every time I enable python-ts-mode[1], Emacs uses up all the memory in my system and explodes. I am able to use a more conservative “just use tree-sitter for syntax highlighting” approach[2], but it feels like I am missing something awesome.

Help! Any tips appreciated.

[1] https://github.com/hnarayanan/dotemacs/blob/main/.emacs.d/init.el#L100
[2] https://github.com/hnarayanan/dotemacs/blob/fix-treesitter/.emacs.d/init.el#L122

harish,
@harish@hachyderm.io avatar

Ok, so I built #Emacs and tree-sitter from source, and python-ts-mode works flawlessly.

This is something deeper about #MacPorts and related shenanigans that I have no time or ability to debug to carefully.

circfruit,
@circfruit@fosstodon.org avatar

@harish hmm, I’m using ready mac os build as well and ts not working. Not a coincidence at all.

harish,
@harish@hachyderm.io avatar

@circfruit I do not think it‘s a coincidence.

circfruit,
@circfruit@fosstodon.org avatar

@harish I’m using eglot with company and pylsp. Couple of days ago installed ruff with pylsp. Works well over tramp too! Haven’t had success with tree-sitter though, for some reason it messes my setup.

harish,
@harish@hachyderm.io avatar

@circfruit I am in the same boat. I can get get tree-sitter working in some basic state (syntax highlighting) as I've shown in my original post. But anything more (as in official python-ts-mode) then it all goes crazy.

Even the most basic setup as far as I can tell reproduces this: https://gist.github.com/hnarayanan/a6397d6723fce19e2802d4305071e611

greg,
@greg@gregnewman.io avatar

@harish what language server is it using and how many python files are open?

harish,
@harish@hachyderm.io avatar

@greg Just the most basic single file causes it to blow up: https://gist.github.com/hnarayanan/a6397d6723fce19e2802d4305071e611

I was running python-lsp-server via a venv, but somehow even when I don't have it installed (as in the venv activated), it still blows up.

ctietze,
@ctietze@mastodon.social avatar

@harish Did just do single file script work for automations. python-ts-mode worked for me there. What's required for you to make things explode (e.g. if you manually enable everything one by one, at which combination does it stop working)?

harish,
@harish@hachyderm.io avatar

@ctietze I will need to piece it together. I will provide some more information after some investigation.

harish,
@harish@hachyderm.io avatar

@ctietze I can break it very easily. Just a minimal init.el file to enable python-ts-mode and eglot for a python file, and loading the most basic file causes it to blow up: https://gist.github.com/hnarayanan/a6397d6723fce19e2802d4305071e611

ctietze,
@ctietze@mastodon.social avatar

@harish Which LSP server have you set up? (Without any I can't even get eglot to start trying to reproduce)

harish,
@harish@hachyderm.io avatar

@ctietze I use python-lsp-server. (But in my observation it fails prior to this but I could be wrong.)

  • All
  • Subscribed
  • Moderated
  • Favorites
  • emacs
  • DreamBathrooms
  • ngwrru68w68
  • InstantRegret
  • magazineikmin
  • thenastyranch
  • rosin
  • khanakhh
  • tacticalgear
  • Youngstown
  • slotface
  • Durango
  • kavyap
  • mdbf
  • ethstaker
  • JUstTest
  • GTA5RPClips
  • modclub
  • tester
  • provamag3
  • osvaldo12
  • cisconetworking
  • everett
  • cubers
  • normalnudes
  • megavids
  • Leos
  • anitta
  • lostlight
  • All magazines