I haven't tried it myself but there seems to be an extension for this: https://pi.dev/packages/pi-lsp