reddit / emacs

Setting up Emacs for PHP/Laravel and Vue.js?

Kaydorf · 2022-08-24 09:09
So... I wanted to start coding on emacs but my workflow doesn't seem to be suitable for it. I code in Laravel and Vue.js on daily basis. What do you guys recommend for setting up Emacs for PHP / Laravel? There is web-mode or php-mode and serenata and intelephense for LSP mode but I still don't know which would be the suitable combination for this setup... And Vue.js seems unusable on emacs since vue-mode is pretty outdated. Maybe I should give up? :(
Horrih · 2022-08-24 10:16
Hey, Can't say for php, but for vue.js i use web mode + lsp-mode, with the vetur language server for .vue files and typescript-language-server for js/ts files It honestly works pretty well. Prettier works well as well for autoformatting so it shouln't be an issue either. For php i don't know but i guess php-language-server should work as well. See the web-mode and lsp mode sections of [my config](https://github.com/Horrih/config/blob/main/.emacs) to help you get started
7890yuiop · 2022-08-24 12:22
I *believe* php-language-server is not recommended (and maybe discontinued) due to bad performance and/or other issues. Certainly it was unusable in my own experience. I *was* working with a fairly large codebase so YMMV; but for me there were files that it either refused to index (which turned out to be due to a hard-coded file size limit), or took something like half an hour to process (if I lifted the aforementioned limit, which was obviously there on this very basis). As ctags could index the entire project in a few seconds, I abandoned the language server experiment pretty quickly.
7890yuiop · 2022-08-24 12:24
`web-mode` is for files which mix multiple languages in the same file (markup and scripting and CSS, for example). If your PHP files are just PHP, you should use `php-mode` for those.
redguardtoo · 2022-08-25 02:22
`web-mode` for php, `js2-mode` for `vue.js`. I also use `counsel-etags` for code navigation and `company-ctags` for code completion. Both requires cli tool `ctags`. I also use `eacl` to auto-complete the code in the project. The reason I use ctags instead of lsp is that my web projects use mixed technologies (scss, postcss, javascript, typescript, styled-component, yaml, sql, ...), a light weight one for all solution is better for me.
Kaydorf · 2022-08-25 14:14
Hmmmm... Alright, I have to figure out how to load both of these depending on the context, but usually my php files are play php...
Kaydorf · 2022-08-25 14:15
Thanks a lot, mate! Do you use web-mode for plain js though?
Horrih · 2022-08-25 17:08
I use it for plain typescript so it should work for plain js as well ! Same for typescript-language-server There are probably other decent modes for plain js, but since web mode does what I need i have not tried them
Kaydorf · 2022-08-29 09:59
Thanks a lot man... And what do you use to search through a whole project btw? counsel-ag or something?