reddit / emacs
VSCode Does This Autoimport, How Can I Get it on Emacs With ts-ls LSP?
_analysis230_ · 2022-08-23 20:40
jacobissimus · 2022-08-23 21:02
Is that what[lsp-completion-enable-additional-text-edit](https://emacs-lsp.github.io/lsp-mode/page/settings/completion/#lsp-completion-enable-additional-text-edit) is for? I don’t use Lsp Mode anymore, so I’m really just guessing
_analysis230_ · 2022-08-23 21:04
I figured it out. i just had to include a jsconfig.json in my root
VSCode doesn't require that for some reason, maybe it takes it as implicit. Hardly an issue
Moving from VSCode to Emacs.
There were some initial issues but I'm starting to love it.
Intrepid_Judgment105 · 2022-08-23 22:43
Any resources you can recommend on moving to eMacs from vscode?
_analysis230_ · 2022-08-23 22:45
Start with doom Emacs.
Doom Emacs discord server is great.
There are some great channels on YouTube, DistroTube comes to mind.
I'm actually starting to love it. I did not expect this.
grtcdr · 2022-08-23 23:18
If you have the time and motivation, you should create an issue to make it so lsp-mode does this automatically and without any manual intervention.
_analysis230_ · 2022-08-23 23:21
I have the motivation.
I might get around to it soon, but I've only been using Emacs for 3 days (1 actually, 2 I just spent installing things). It's 5am, I can't sleep. I'm in love. I don't want to stop using it.
Two_Souls · 2022-08-23 23:30
I would actually suggest checking out System Crafters YouTube series on Emacs From Scratch. He goes through all the steps to setup.
Personally I would say avoid doom and actually learn about Emacs this way.
MonsieurPi · 2022-08-23 23:45
You traveled a nice journey coming from your initial posts in this sub. Glad you found your way and welcome aboard :-)
lebensterben · 2022-08-23 23:55
I second this. DT is good in that he introduces people to Emacs, but overally his video lacks depth. SystemCrafter actually explains things very well.
redguardtoo · 2022-08-24 00:36
surely you can set up LSP packages to make Emacs to do the same thing as VSCode.
But in this case, since you are developing typescript/javascript component. There is much faster way to input the reference of a component.
Check screencast of [https://github.com/redguardtoo/eacl](https://github.com/redguardtoo/eacl)
In any real world project, re-using other team mates' code is much more efficient than writing your own code.
For example, instead of inputting comnponent's tag name and attribute one by one, you can quote the code of same component written by other developers in one shot.
stoopidjonny · 2022-08-24 01:00
I think it is better to use Doom at first just to see what emacs can do and see if you like it before writing your own config. Or you can use chemacs and use both.
CannibalismIsNatural · 2022-08-24 02:36
I'm using EXWM on GUIX because of that channel. I'm not necessarily happy with this decision but I don't want to stop using it either.
Acebulf · 2022-08-24 02:38
IDK if it's of any use to you, but I'm actually working on porting the material ocean theme to emacs atm.
Very happy to see someone else using this superior color scheme.
If youre interested let me know, and I can give you a ping when it's ready to release
Brax8888 · 2022-08-24 02:46
If you don't mind my asking, why don't you use lsp? Or do you just mean you use eglot?
SnooPets20 · 2022-08-24 03:02
I guess this varies from language server to language server. `rust-analyzer` for instance does this automatically.
ilemming · 2022-08-24 03:27
> Moving from VSCode to Emacs.
This is so good to hear. I'm getting a bit tired of "everyone knows and uses VSCode" vibe. It seems like there's no escape from it. They're pushing it so aggressively, it feels people are almost forced to switch.
_analysis230_ · 2022-08-24 03:54
Oh I'm definitely interested. Where can I subscribe for updates?
_analysis230_ · 2022-08-24 03:57
So... The difference is if you have some time to tinker or if you're actively working and would like to get a feel for Emacs while you do your job.
I've tried to learn Emacs twice before and only this time I think I'd actually learn something.
_analysis230_ · 2022-08-24 04:00
I am positive VSCode uses lsserver too.
i haven't checked though
_analysis230_ · 2022-08-24 04:04
So I'm still learning things, but I am using lsp +peek
And then ts-ls as the language server.
I know there's an eglot option, but I don't know what it does. I was just told by a friend to keep it at peek
PhantomSeahorse · 2022-08-24 04:04
I believe LSP was developed by MS with VSCode in mind. Not sure tho
Acebulf · 2022-08-24 04:16
I don't have anything public at the moment, mostly because this exercise started as an effort to customize the theme, but I ended up reverting it to the color scheme in Material Ocean. (https://github.com/Patrick-Poitras/bright-tungsten-theme)
I'll probably have something workable by tomorrow, I'll send you a link once I have it set up.
Also I'm mostly going to be doing the high contrast version at the start, but it should port over easily for the regular version. Development of this thing is with autothemer, and it's going really fast at the moment.
SnooPets20 · 2022-08-24 04:47
Yes that's right. The LSP is a Microsoft protocol designed with VSCode in mind. So, yes, VSCode does use LSP.
However, how each language server is setup and configured varies by editor. VSCode might use some better defaults for each language server.
_analysis230_ · 2022-08-24 05:15
Checked out system crafters and it's an awesome resource.
I might someday get around to making my own config.
aard_fi · 2022-08-24 06:51
Not the one you've asked, but: I've set lsp up a bit over half a year ago to see what all the fuzz is about, played a bit with it, but didn't really see it helping me enough to be worth the effort I've spent on setup.
I have it in my config in case I want to play again, but not autoloading it, so I can easily play with it if I want to.
Two_Souls · 2022-08-24 07:16
Yeah of course. Each to their own, every one will have their own journey.
I was still using Neovim for the day job and tinkering in the evening until my Emacs was ready to use on a daily basis. The tinkering never stops tho but this is part of the reason I love Emacs.
This is I think my third attempt at Emacs and this time its for good! Thanks to System Crafters.
Two_Souls · 2022-08-24 07:19
I did try Doom before and I just didn't really know what was going on. So I invested the time to start from scratch and build it up.
But I already knew that Emacs was for me so went all in. And I don't regret it one bit.
MonsieurPi · 2022-08-24 07:47
Eglot is not an lsp-mode option, it's another lsp mode. I personally use lsp-mode but I heard eglot is faster with less functionalities.
elgrekoo · 2022-08-24 08:20
You can try this package: https://github.com/KarimAziev/js-imports
_analysis230_ · 2022-08-24 08:34
Thanks. I was able to resolve it just by including a jsconfig in my project.
jacobissimus · 2022-08-24 11:14
A better workflow for me was to just quit my Java job and become a Clojure dev instead. Now I do everything with Cider instead.
monad_in_disguise · 2022-08-24 11:51
When everything lines up, it is a nice feature of vscode. when it doesnt, it can cause chaos:
Back in the 1.x version of `parcel`, it would auto-add packages to your project if you mentioned them in an import (i dunno if v2 does this). So if vscode added something, but it "guessed" the import string "wrong" parcel may think you wanted a new package with a similar name installed, rather than a project local one or whatever. Parcel would then start fetching things, and soon your project would be filled with stuff you never wanted/needed all because vscode guessed a root-level index.js, rather than a specific file (i.e., `src/foo/index.js` when imported as `import * as Foo from 'foo'` when there is an npm package also called `foo`).
technically this is my fault for using bundler "magic", but you get the idea:
> Explicit is ALWAYS better than Implicit.
_analysis230_ · 2022-08-24 12:13
Well. I'm trying to move away from VSCode, god knows why. But am not gonna poop on it
My experience with VSCode has been nothing but great. Just worked out of the box and I didn't see too many bugs, vim extension not working properly was the only bug I saw in maybe about 2 years of use.
wolfjb · 2022-08-24 12:22
You could look at Crafted Emacs (https://github.com/SystemCrafters/crafted-emacs) as a possible good starting point to your own config. It isn't the kitchen sink like others (Doom, Prelude, et. al), but if you enjoy tinkering a bit to get your config "just right" it might be worth the effort.
_analysis230_ · 2022-08-24 12:33
Possibly.
Currently, I'm rocking doom Emacs and I have gotten comfortable with the controls and the experience. I am able to navigate faster than ever before.
It's probably possible to do use the same keybinds in VSCode for navigation but I am not sure why I didn't ever put the effort in. It feels right on the Emacs
monad_in_disguise · 2022-08-24 12:37
oh this isnt so much a vscode ding as it is a "always beware of 'magic'" 😅
There are many things of vscode that i dislike, like way too much mouse interaction being required. Sure, things like custom bindings and VSSpaceCode help, but emacs does have a lot more power with things like eglot, lsp-mode, embark, corfu, etc. But of course, emacs is also more fiddly, so some things don't "work out of the box" and require config. So ultimately, its more of a question like:
>do you want to use a "standardized" development platform?
then use VSCode
>do you want to use a development platform that is custimizeable to how YOU think/work?
then use Emacs
😁
_analysis230_ · 2022-08-24 13:01
I think VSCode is very well suited for people who have a life.
Emacs is suited for nerds like us who don't mind working an 8 hour day and then spending 4 more customising the editor as a hobby.
monad_in_disguise · 2022-08-24 13:30
truth 😅