DEV Community

Wesley Cheek
Wesley Cheek

Posted on

Lapce Typescript Support

I've been looking for a decent alternative to VS Code for a long time. I love VS Code but let's face it: it's slow and bloated if you're not on some good hardware.

I just discovered Lapce and was immediately impressed by its potential. It's an open-source text editor fully written in Rust, it's lightning-fast, and already has some nice features out of the box like native modal-editing (vim), language features through LSP providers, decent Git support, and an integrated terminal.

I'm posting this, because for whatever reason, getting Typescript support working was a pain in the ass.

1.
Install typescript-language-server and typescript (Requires NodeJS) via npm or your system package manager:

npm i --global typescript-language-server@2 typescript
The plugin page did not specify the @2 version, may have been my problem.

Server needs to be in one of the paths included in PATH environment variable.
This turned out to not work for me, may have also been my problem.

2.
Add the TS / JS plugin to Lapce.

3.
Edit the Lapce settings file by pressing Ctrl + Alt + P and typing settings file. Add these settings to the end:

[lapce-typescript.volt]
serverPath = "C:/Users/username/AppData/Roaming/npm/typescript-language-server.cmd"
serverArgs = ["--stdio"]
Enter fullscreen mode Exit fullscreen mode

Where the serverPath is going to be specific to where npm puts global installs.

Lapce is still missing a few things and it's modal support is adequate at best, but it's okay since it's still in Pre-Alpha. For the speed, I'm going to consider the lack of features a decent trade-off. I look forward to see where it goes from here!

If you try Lapce, let me know!

Top comments (0)

typescript

11 Tips That Make You a Better Typescript Programmer

1 Think in {Set}

Type is an everyday concept to programmers, but it’s surprisingly difficult to define it succinctly. I find it helpful to use Set as a conceptual model instead.

#2 Understand declared type and narrowed type

One extremely powerful typescript feature is automatic type narrowing based on control flow. This means a variable has two types associated with it at any specific point of code location: a declaration type and a narrowed type.

#3 Use discriminated union instead of optional fields

...

Read the whole post now!

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay