- 15
- 69 010
Jeffrey Chupp
United States
เข้าร่วมเมื่อ 25 ก.พ. 2009
I'm all-in on developer tooling. Currently obsessed with the Language Server Protocol (LSP) and CLI tooling.
Ergonomic Go CLIs with Cobra
In this episode, we add Cobra to improve the ergonomics of our Golang CLI for creating EPUB stories from markdown.
Github Repo: github.com/semanticart/squire/
PR with all code from this video: github.com/semanticart/squire/pull/4
More about Squire here: squirebooks.com
00:00:00 - Intro
00:02:02 - Using the Cobra Generator
00:04:22 - Adding our Validate command
00:08:32 - Adding our Convert command
00:18:48 - Outro
Github Repo: github.com/semanticart/squire/
PR with all code from this video: github.com/semanticart/squire/pull/4
More about Squire here: squirebooks.com
00:00:00 - Intro
00:02:02 - Using the Cobra Generator
00:04:22 - Adding our Validate command
00:08:32 - Adding our Convert command
00:18:48 - Outro
มุมมอง: 356
วีดีโอ
Creating EPUB Books in Go
มุมมอง 8374 หลายเดือนก่อน
In this episode, we build a converter to turn an interactive fiction story into an EPUB ready for publish in the Kindle Marketplace. We'll also support exporting a standalone interactive HTML website. We're using the Squire format to publish interactive fiction to the Kindle store using free tools and simple Markdown syntax. Learn more about the format here: www.squirebooks.com/ Github Repo: gi...
Let's Go(lang): building a parser + validator for Choose Your Own Adventure-style stories
มุมมอง 9205 หลายเดือนก่อน
Ever wanted to publish your own Choose Your Own Adventure-style book? I did, and I wanted it to be as simple as possible. I'm introducing the Squire format to publish interactive fiction to the Kindle store using free tools and simple Markdown syntax. Learn more about the format here: www.squirebooks.com/ In this episode, we build the initial parser and validator in Go. We'll implement this as ...
Write Super-powered Documentation with Cognitive Breakpoints
มุมมอง 9918 หลายเดือนก่อน
Software engineers famously hate writing documentation. I get it: it is hard! Reading documentation isn't all fun and games either. We need a new approach. Cognitive Breakpoints are like responsive-design for documentation. They allow readers to choose their own adventure on how much complexity they want and free documentation writers to pour all the detail they want into the docs without worry...
Beyond the LSP with ruby-lsp and Neovim - Custom Methods!
มุมมอง 2.5K8 หลายเดือนก่อน
ruby-lsp recently added a custom method (beyond the Language Server Protocol) to show dependencies. How does it work? It is only implemented in the VS Code extension, so how can we use it elsewhere (e.g. in Neovim)? Are custom methods a blessing or a curse and how should language server maintainers think about them? 00:00 - ruby-lsp just got better 00:29 - Spelunking in the VS Code implementati...
Language Server from Scratch: Integration Testing, Hover, and Hands-On Exercises (LSP)
มุมมอง 1.5K9 หลายเดือนก่อน
00:00 - Intro 00:10 - Integration testing our Language Server 07:31 - Challenge 1: Shutdown & Exit 07:45 - Implementing Shutdown and Exit Together 10:01 - Definitions on Hover 17:42 - Challenge 2: Hover 17:59 - Implementing Hover together 35:07 - Optional challenge 35:54 - Document Lifecycle fix with DidOpen 40:34 - Closing We'll continue building our own language server in TypeScript by follow...
Stop saying “um” - Building an AI-powered Filler Word Detector
มุมมอง 5409 หลายเดือนก่อน
Let's build an AI-powered filler-word detector to play an air horn when we say "um" or "uh." We'll use powerful off-the-shelf tools and wire them together with minimal code. 00:00 - Intro 01:17 - Getting Started 03:17 - Recording in chunks 06:15 - Roughing out recognition 07:16 - Detecting filler words 15:16 - Adding the air horn 16:56 - Faster feedback with whisper.cpp 20:58 - Outro - Sox: git...
LSP: Building a Language Server From Scratch 2 - Diagnostics and Code Actions
มุมมอง 3.7K9 หลายเดือนก่อน
00:00 - Intro 00:46 - A quick fix-up on completion 03:03 - Diagnostics 13:23 - Showing Spelling Errors with Diagnostics 21:48 - Spelling Suggestions in Diagnostics 37:16 - Code Actions for Spelling Corrections 51:44 - Outro We'll continue building our own language server in TypeScript by following the Language Server Protocol. We'll build diagnostics to show the user problems in their document ...
LSP: Building a Language Server From Scratch
มุมมอง 46K9 หลายเดือนก่อน
00:00:00 - Intro 00:00:52 - Getting set up 00:05:52 - Starting from Scratch 00:12:40 - The initialize method 00:19:38 - Processing messages in batches 00:24:18 - Responding to initialize 00:30:43 - Implementing completion 00:42:45 - Document Synchronization 00:56:24 - Smarter completion 01:07:02 - Testing against Neovim 01:08:23 - Outro / Next Steps In this video, we'll start building our own l...
LSP Intro + Language Servers Aren't Just For Languages
มุมมอง 7K9 หลายเดือนก่อน
0:00 Intro 0:12 A brief look at the official introduction 1:13 Not just for languages 1:22 An example interaction 1:57 LSP for languages 2:29 LSP for Frameworks 2:47 LSP for SaaS Developer Tools 3:07 Code reuse 3:26 Beyond the LSP: Progressive enhancement 4:58 Outro What is the Language Server Protocol? How are Language Servers being used in the real world today? What opportunities do they prov...
entr: --watch anything. Run arbitrary commands when files change.
มุมมอง 1.5K10 หลายเดือนก่อน
entr is a commandline tool that brings watch flag functionality to anything: from a popular tool that doesn't have watch support yet to your bespoke shell script. - github.com/eradman/entr - eradman.com/entrproject/ 0:00 Intro 0:29 Eslint example and breakdown 0:50 Ruby/Rack example 0:57 SQL query example and /_ explanation 1:21 Rendering Markdown example 1:43 Observing newly-created files 1:55...
fx: A better JSON tool than jq
มุมมอง 1.3K10 หลายเดือนก่อน
fx is my favorite terminal-based JSON tool. Let's look at how it lets us interactively explore, query, filter, and edit JSON. To wrap things up, we'll compare it to jq, and I'll explain why I prefer fx. Official fx website: fx.wtf/ Accompanying blog post: blog.semanticart.com/2024/01/02/fx/ 0:00 Intro 0:27 Interactively browsing JSON with fx 1:10 Querying JSON with fx 2:00 Writing custom functi...
JSON-RPC and the Language Server Protocol (LSP)
มุมมอง 1.5K11 หลายเดือนก่อน
JSON-RPC and the Language Server Protocol (LSP)
This should be very useful. Thanks!
I've written a compiler for a language like TypeScript but slightly different and for use alongside C++ as a high-performance video game scripting language. I have been dreading the task of coming up with an extension for VS Code because I've found so few good resources about it but this series has really cleared a lot of things up. I have to implement the LSP in C++ for best results so it'll be a little different but I appreciate the work you've done here very much. Thank you!
Could you make an lsp client from scratch. Your teaching style is excellent and I cannot find any tutorials for the other way round
This is FANTASTIC content Jeffrey! Thanks a lot for making it, it's very valuable for anyone who's even slightly interested in LSP like myself! (and in particular, LSP in neovim)
Thank you so much for the kind words.
Ouh yea thank you sooo much. I need to build one and this will give me a good start I guess.
Good luck and have fun!
Thanks for the video! Any chance the next video could explain the library instead of writing everything from scratch? Regards
You're welcome. I'll think about that one. Stay tuned!
Wow, I just built a LSP from scratch! Thank you! I couldn't get nvim to attach with just your code, but watching TJ's video with the vim.api.nvim_create_autocmd did the trick. Reference video with timestamp: watch?v=YsdlcQoHqPY&t=1915s
Right on, congrats! And I appreciate the heads-up about attaching.
you should add more videos to this series!
Thanks for watching. I might revisit it at some point 😀
You are my God.
I'm just a dude. Thanks for watching.
This is awesome, thank you!
You’re welcome! Thanks for watching
Hey Mr Jeffrey please do share more awesome golang stuff with us.
Will do. Thank you so much for the kind words
Wow super cool learnt a lot
Glad to hear that!
Hey I know it's been a few months, but this video has been really helping me become more familiar with LSP. I am building a language server for my internship. I was wondering if you have any idea why I am getting an error "The language server is either not installed, missing from PATH, or not executable." in neovim. Everything else worked flawlessly! Thanks!
Thank you for the kind words. This is a good question. There's a few things that can go wrong here. First I'd check to see if running the `cmd` for the `vim.lsp.start` runs fine when you run it directly from the terminal (it shouldn't do anything, but it should sit there waiting for input without crashing). If that works, then your neovim probably doesn't have the same $PATH setup as your terminal and you can pull on that thread (or specify absolute paths, etc). If that didn't work, then hopefully it exited with a helpful error message. Let me know how it goes!
@@semanticartThanks for the quick reply! I confirmed that running the command "npx ts-node <absolute/path/to/server.ts>" did kick off the server. I am on Windows and have never used neovim before so it may be something with my neovim config or something. I didn't mention at first but the error message also includes "Spawning language server with cmd: {"npx", "ts-node", "<absolute/path/to/server.ts>" failed." So it is successfully trying to spawn it with (seemingly) the right command. I don't know where to look for more details on the failure. (like a neovim error log file or something?)
@@PriZ0nM1ke try this. Hit colon to get into command mode and do !npx ts-node <absolute/path/to/server.ts> and hit enter. See if you get any helpful message from that.
@@semanticart It runs the file (I put a console.log() at the start to confirm) but doesn't hang like in a terminal. Doesn't throw any errors as far as I can tell.
@@PriZ0nM1ke Hrm. Check the lsp log file (get the name via `:lua =require('vim.lsp.log').get_filename()`). You can also set `vim.lsp.set_log_level("DEBUG") ` BEFORE starting the language server to (hopefully) get more info
Is it required to use typescript instead of another programming language ?
No. You can write one in literally anything. Here's a very boring example I wrote in bash: prefab.cloud/blog/writing-a-language-server-in-bash/
This is fantastic! We use an old proprietary vendor language a lot at my job, and the only real IDE that supports it is nearing 20 years old at this point. Dove into writing my own lsp for it and this is the best thing I've found that made it all make sense. Thanks for the content!
Thank you so much for the kind words! Best of luck with your language server
what font are you using
Monaco :) I've tried so many fonts but always come back to Monaco
LSP in Java, C# and even PHP: The Liskov Substitution Principle LSP in Golang: Language Server Protocol
Not sure if you're trolling or not, but this video has nothing to do with Golang. Also, there are language servers for Java, C#, and PHP.
neat!
Relatively soon I will be attempting to make a language server for a language I use at work. Its a language similar to pascal that is used for a specific application. So I am consuming as much knowledge on LSP's as possible as well as trying to learn JavaScript/TypeScript. Your videos have been the best by far! Hopefully I can figure out how to adapt what you have done into something useable for this language. I would love a video going into the details of working with multiple files. As in if one file imports another file, and I use a constant from that import, I want to see the value of when I hover over it as is defined in the other file. That is the late game goal! Anyways, thanks for the video! These are great quality and I'm sure your channel will be growing rapidly soon!
That sounds fun! Let me know how it goes. I don't know when I'd be able to make a video about that, but I can give you a quick overview of how you could do it. 1. As you've seen in the videos, you need to keep track of the files that are open in the editor. You can do this by listening to the `textDocument/didOpen` and `textDocument/didClose` notifications. 2. When you hover over a symbol, you need to find the file that contains the definition of that symbol. You'd need to do this by parsing the imports of the file that you're currently in. 3. If the file that contains the definition of the symbol is open, you can show the value of the symbol. If it's not open, you can read the file from disk and show the value.
@@semanticart appreciate the response! That sounds like the next big step. I spent all day Saturday and Sunday messing with it. I got a lot of it working! I’ve got hover and completion working (for this file only, it doesn’t look at other files yet). There’s an added layer of difficulty because for the language I’m doing the #includes are not direct path names. I have to find it through a database. I’ve been working on trying to right an EBNF into an ANTLR. Then I’m going to attempt to make a parser so I can tell the user about syntax errors. I’m not even sure if that’s a thing/ the thing to do but yeah. Any quick tips about showing syntax errors?
@jondanford That's some great progress! I expect that diagnostics should cover you on syntax errors. You can specify the range of the document they cover, severity, and the message content. microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#diagnostic
@@semanticart Yeah! That is what I am currently using, but I was hard programming the syntax errors myself - like a noob. I am trying to add a parser that will return errors that I can then send back with diagnostics. (Hopefully) I think my grammar has some errors in it, but that can be ironed out later.
@@jondanford Gotcha. If there's an existing compiler/parser that returns errors, I'd try (ahem) parsing those from your LSP. If not , then godspeed working on your parser/grammar 🍀
Great 👍
Thanks for watching!
Could this be achieved solely with Markdown?
Great question! For the basics, absolutely. I have an old blog post here about using Pandoc to process the markdown for this purpose blog.semanticart.com/2014/01/11/writing-hypertext-fiction-in-markdown/ What's missing is that Pandoc's error messages are tailored to generating valid html/etc., not to helping the user craft a valid story. My goal is to build an entire suite of tools here under the MIT license that anyone can use as they wish. Stay tuned for more!
@@semanticart nice, thanks for the blog.
Loving the series-Even as someone unfamiliar with TypeScript, the content is clear and easy to follow. Additionally, the speed is great-I don't have to speed it up! Quirks: I'm on Windows, went with hunspell instead of aspell. Install is clunky as hell, but it works. 38:05: Mentions adding a codeActionProvider to capabilities, but it's not shown. Had to come back to that part once we start testing at 45:16 😅
Thanks for watching and for the kind words. I'm glad you're able to follow along well and that the speed works for you :) Apologies for any confusion related to capabilities. Editing is hard and I'm still figuring it out 😅
this is cool! I'm planning on writing a toy language + compiler for it in golang, and an LSP will be a great addition to the project. Thanks for the awesome video, hope I get to see more contents on this channel!
That's awesome! LMK if you end up publishing that LSP, I'd love to take a look. I'm getting into Go, so I'm sure to have some future LSP+Go content here.
This series has been really helpful in making my first LSP in Lua, thank you so much!
Glad I could help! If you publish your LSP somewhere, please send me a link :)
Simply an amazing video! Thank you so much for making this!!
My pleasure! I'm glad you enjoyed it :)
I'd say the first thing you should consider is the ability to reuse existing language tools for the lang in question - e.g. if the compiler and all surrounding tooling is written in Java, chances are you can utilize that from a JVM language much more easily than from something native. Contributions are also nice to have, but you need to be at least mildly successful in order to have a community 😅 agreed on the rest
That's a fair point. Thanks for the comment!
That was actually helpful, thank you.
Glad it helped!
Hey, thanks for putting this out. I am also trying to build a lsp for a language, can you tell me what are the things that I would need to do differently, here are my doubts: 1: Do I need to do something with the language grammar? 2: Would I need to implement the language compiler in the lsp too? Example of what I am looking for: When I type 'lan,' I expect suggestions for words like 'language.' Then, when I type a period '.', I expect suggestions like 'python,' 'JavaScript,' etc. Next, when I accept a suggestion and type another period, I expect options like 'enable/disable.' So, in the end, I want to form a string like 'language.python.enable. An example syntax for the language that I am working on is: language.python.enable = true; which can also be written as language.python { enable = true; } I would be really grateful if you can share a pointer on how to approach this.
Rishi, it was great chatting with you today. Best of luck with your project!
Great content! Is it possible to create a language server or, alternatively, connect to a language server from a web-based code editor?
Thank you. It is possible but it is trickier and depends on the execution context of the editor, etc. It is outside my area of expertise but I know that twitter.com/PaoloRicciuti has done this for www.sveltelab.dev/ with some combination of Codemirror and/or webcontainers.io/ He's a nice chap so I'm sure he'd be happy to give you a few pointers.
Brilliant idea! thanks for sharing 🙏
Glad you liked it!
This is informative! But I wanted to confirm that to add the support for a particular framework/tool, it requires several things: 1) adding a capability; 2) implementing the capability in both the IDE and the server side. Is my understanding correct? There seems to be a lot of work.
If you're implementing functionality covered by the LSP, then you shouldn't have to implement any functionality in the IDE (if the IDE/editor already supports the LSP -- many do). You should only have to implement the functionality in your language server and all LSP-enabled editors can use it for free. If you're implementing custom functionality, then yes, you'll need to implement things in both your language server and some glue code per IDE. That's non-trivial for sure, but putting the functionality in a language server means you get to re-use that for every editor and just have to handle the glue code for the editors. This is much less work than implementing ALL the functionality (both the UI and backend code) in each editor. :) I have a video where I look at a ruby-lsp custom method that only has support in VS Code and implement the glue code for neovim. You can check it out here: th-cam.com/video/8_u0Fvtq_ew/w-d-xo.html
Awesome vid, just what I needed!
Glad it helped!
cool!
Thanks! Have a great day
Fantastic content! I'll slowly follow along later this week. Thanks a LOT for the great LSP content!
Thank you for the kind words and have fun following along 😀
This is really amazing. I'm gonna set this up as soon as possible!
I hope you enjoy it! My PR was merged so you can use the official docs to get this feature :) github.com/Shopify/ruby-lsp/blob/main/EDITORS.md
I love the concept and idea, but wouldn't it make more sense if level one was only a basic usage example, and the deeper we go, the more details we have and the more complex examples get? This way, level 1 would also work as a quick reminder and a cheatsheet. And in most cases, that's all you need. I'd love to know what you think!
I like this. It makes sense especially when you're trying to document the broadest usage of a tool. e.g. I could imagine a page for `pandoc` where 1. a sentence describing pandoc 2. ` brew install pandoc` to show how to install it (simplified because we've detected you're on macOS) 3. `pandoc example.md -o example.html` to show an example usage I'll think more about this. Thanks for the suggestion!
And thank you for the great idea! I have a feeling cognitive breakpoints will soon be *the* way to write documentation. I, for one, will definitely be using it. And maybe even add a global and local preference, like: 2 would be my preferred breakpoint. Then, while scrolling down, I might hit a section that I don't quite understand, so I can change the breakpoint only for said section without affecting the rest (just another thing to think about).
@@D33P-5H4D3 I love the idea of site-wide preferences. I've also been thinking about per-section sliders too for expanding (e.g.) just code example. Per-section sliders feel overwhelming, but time will tell. Please LMK if you do anything with this in the wild 🙌
Brilliant idea! Very intuitive use of markdown.You should pitch it to Atlassian. You could probably do it all with just css using a few radio buttons, you know just to flex.
Thank you for the kind words! I hadn't thought about trying to CSS-ninja my way through this but you're probably right that one could.
It’s like C4 but for the text, right?
🤔I'm not sure what C4 is in this context? Mind sharing a link?
Love this. Just this morning I was thinking about glossary pages for statistics on our site. I was planning to offer different versions (short, in depth, actual math formulas) on the same page, but this is a unique way to present it.
Yay! Please lmk if you use some variation of this. I’d love to see it in practice. I’m super down to collab if I could help!
I love this. ELI5 docs!
Thank you, kind sir!
Cool idea! Nice video too
Thank you for the kind words
Any chance to get a video to configure ruby-lsp-rspec with neovim code actions? (Great video btw)
Thanks, Kassio! This is a bit tricky. The ruby-lsp-rspec addon exposes CodeLenses for Run, Run In Terminal, and Debug. I suspect those should show up in your Neovim (assuming you have a current-ish Neovim) but there might be some intelligent feature-detection to avoid showing these in Neovim (hard to say without doing some digging). But then the problem is that Neovim doesn't know how to handle the command associated with each CodeLens. The VS Code extension specifies the commands (example: github.com/Shopify/vscode-ruby-lsp/blob/b8771484173f8fe9324e6a14f5d16e63b55686ee/package.json#L70-L73 ) and then later registers the commands (example: github.com/Shopify/vscode-ruby-lsp/blob/b8771484173f8fe9324e6a14f5d16e63b55686ee/package.json#L70-L73 ) To make this work in Neovim, you'd need to add handlers for each of these commands you wanted to support. The implementation would depend on what test runner you're using in neovim. I'll definitely consider exploring this and making a video. How do you currently run tests in Neovim?
Hey Jeff, thank you so much for all the LSP videos. Because of them it was way easier to implement LSP support to my pet vimlike editor I'm writing in rust: th-cam.com/play/PL9KpW-9Hl_het1V3_dLhG_0K99a9043ac.html.
You're super welcome, thanks for watching. It means a lot to hear about real-world impact. You've got a new subscriber :)
Keep going your videos are super helpful
Thanks! I'm glad you're enjoying them.
The only typescript video you ever need.
😄 Cheers!
Hey Jeff, just dropping by to say a huge thank you for the awesome content you're putting out! Your videos are an absolute goldmine for someone like me diving deeper into LSP configs and all that jazz. Seriously, your work is really appreciated mate! Can't wait to see what else you have in store, so keep 'em coming! Subscribed and eagerly awaiting more!
This comment means a ton to me. Thank you so much for your kind words and encouragement. I’ll try not to disappoint 😀
I hope to get a PR up soon to update the editor integration advice github.com/Shopify/ruby-lsp/blob/main/EDITORS.md
PR is here: github.com/Shopify/ruby-lsp/pull/1389 ...and it is merged!
Finish
Better Finish than unfinished 🥁
I recommend you to try bun testing, it's way faster than jest
Thanks. I use bun's built-in testing on other projects, I'm just trying to keep keep things more vanilla here :)
Did you do the challenges? Do you enjoy exercises in videos like this?
Absolutely Jeff. Please keep them coming. Would love to see how these language servers can work in Monaco in the web. Thank you so much.