YouTubevideo· Dec 11, 2024· 20:23

Livewire Volt has a VS Code Extension Now (and I'm so excited)

Watch on YouTube ↗

transcript

48 moments
  1. you have so many options for building a front end within a larl application you have inertia and inertia has react and View and felt and probably other community adapters now or in the future and then you have just blade within larel that's just server render templates and there's a lot of stuff you can do within that then you have live wire but even within Live Wire there's three kind of options there's the traditional class-based separate files

  2. where you have your PHP file and then you have your file uh but then there's volt and even volt has two different options where it's a functional style where it looks a little bit more I don't know functional but then there's also the class bace that's a little bit more traditional just those two files squished together and I would say within that the traditional Live Wire is probably most popular and then within volt class base is probably most popular

  3. and I I don't really have too much of a preference usually I'll tend to pick volt within class based but there's a reason why a lot of people don't choose volt and when I asked on Twitter these are the responses I got a while ago I said uh for those who haven't heard of Volt or for those who don't use it what's stopping you basically uh especially when you see this sentence volt is an elegantly crafted functional API for Live Wire that supports single file components

  4. even that's a little bit different because it's not just the functional API it's the start of it and you can use class based if you want as Anonymous component but most people who said they're not using it say they just tend to reach for traditional Livewire because of IDE support it doesn't feel complete it doesn't feel proper but maybe that's changed Rob sentino the creator of marui which is

  5. basically the daisy UI port for laravel and Livewire created voltage which is a vs code and also like cursor when surf through open vsx uh extension to give you a ton of stuff in your vs code specifically for Live Wire volt why don't we take a look at the GitHub repo so voltage Live Wire volt and blade intellisense for VSS code cursor winds

  6. Surf and so it's just the class based for now not the functional API that's the one I particularly use the class-based one and it works specifically to use this as the PHP language mode some of the features it has is autocomplete so being able to have the autocomplete four Live Wire methods within your code and we have to turn on this quick suggestions for Strings but it also formats using

  7. laravel pint I've already installed it but let's go ahead and mess with some of these settings and I'll kind of show you what it does I think it's really really neat so I'm using this within my fishion starter kit which is folio and volt kind of pushed together which I I think this still works because I'm using Anonymous components which is just the at volt tag but I think it still works because that's just a PHP tag but uh one of the

  8. things that I did notice that when I enabled the voltage component is I had to disable any other blade formatter so before I believe I had yeah nothing enabled for blade but before I had uh the tall stack package installed which included the L of a blade formatter and maybe something else but this is the only one that I had to disable because voltage is basically going to take care

  9. of that for me now it is a blade format so blade intellisense specifically for Live Wire volt I think this is just the way the Robson had to go in order to make this work particularly for volts so I think there's another couple options that we have to set up so if we take a look uh in the components we have to turn on editor quick suggestions for Strings so if we go to our user settings

  10. Json I think yep quick suggestions strings is already turned on and then we need to make voltage as the default formatter for PHP let's see if we have that PHP oh there we go we're going to turn that to the voltage which enables P it's looks it looks like I previously had that set to Pint and then I'm going to make sure Lille pint is installed at

  11. least on this project I believe it is let's go ahead and check yeah nothing to install so we're good because cuz pint install I believe is installed out of the box now within Lille if not I had it installed in my fion starter kit and then add prettier the prettier plug-in blade so this is stuff I'm probably going to start uh adding to my starter kit as well we pop that in and we're not going to use yarn Das Das

  12. include Dev there we go and then we're going to create a prettier RC file at the root of our project and I believe I have the prettier EXT ition installed so I should just be able to do prettier create configuration file and we're going to choose the root of our project voltage test and then we should have that prettier RC file and I'm going to say this and I might keep this and we'll

  13. do this right here there we go I like it enable format on Save I believe I already have this but we'll see in our user settings a format on Save save I do perfect and then that should be it so now if I go to maybe like the the playground component now this is all formatted within the

  14. voltage com the voltage uh extension so if I was to like uh redo some of this this should format automatically and yes we do and now the cool thing is it's it's autocomplete so I believe if I was to do something like public function maybe this is going to be a method within volt where I say this is um I don't know add to cache and I say like

  15. this is Cash we have an undefined type of cache so I should be able to pull this in yeah this is something even just like something like this is like super nice for me because before I was kind of manually having to type this out um and now it has all like the PHP functionality that you would expect within traditional classical components but not only that we have the ability to then have this be

  16. autocomplete I have this add to Cache that we we're able to Auto Import those in but now if I have this button let's say um wire click equals and then we have um let's see we have should have this automatically pulled in maybe it does not work on Anonymous components let's go ahead and make a new component

  17. just to see PHP r in make volt new component d-h class okay let's see all that should work still but we're going to remove this we don't really need these anymore I'm just curious if it's the anonymous component that might not be working properly so why click equals and then in here I don't think that's right let's

  18. see public string name then we should have input wire Model H interesting all right I'm back I had to do some digging uh and I realized that the uh voltage component or the voltage extension by Robson tenorio um it only works if you're using

  19. the slash Livewire route so if you quick real quick if you don't know volt has the option of uh installing and the volt service provider mount in either the resources views Livewire or resources views Pages directory and within my starter kit the fision starter kit I'm using folio which automatically defaults to the Views Pages directory and it looks like the extension isn't set up to be routed in there um and Robson

  20. actually commented saying that he's going to get this fixed so editing Josh stepping right in because before I had a chance to even finally publish this video uh Robson Torio actually fixed the request that I opened so uh yes the directory wasn't checking for Pages directory it was just checking the resources of views live wi directory and Robinson fixed it so that now it all

  21. works with folio so if I was to open my code editor right here uh let's say we have this add to Cache function and before we wouldn't be able to get this method but if I was to go ahead and close this wire click equals and now we have the add to cash again it would be nice if we didn't have like the the mount one popping up but this is still nice to be able to click up here and now

  22. it works in folio with uh volt now back to the video let's look at some of the features uh in a more classic volt component style I have my project that I built using or within the lar cast course so let's dive into there because it's a pretty uh big component and it'll be good to kind of showcase some of the features now that we've got it all set

  23. up in vs code all right so this is in the Livewire directory which it looks like that's what it's starting to pull from and then I do have some pages directories as well as and so maybe like Pages show would be like a good one um it looks like we have UND some yeah we don't have we have some stuff now that I have a actual PHP thing I haven't been able to look at this uh

  24. but now I can pull in like things like these session facades um yeah everything looks good there no configuration file found for this project so why don't I copy that over real quick just what we are using in our other directory all right now I got those fixed there's a couple other things I need to fix on this page and it's nice to be able to have that some of that uh options now especially now

  25. that it defaults to the PHP and volt voltage plugin so I have voltage plug-in installed and in my prettier file that is what is using the prettier plug-in blade which is defaulting to um the voltage plugin right here for the for the PHP parser um that's what we had set up within our vs code settings but this

  26. also has Alpine JS um formatting as well I do have an Alpine JS syntax highlighting as well but if I was to disable that I believe we should still keep formatting yeah so if I was to disable enable it yeah it looks like exactly the same so disable enable yep exactly the same so I I'll I'll keep this uh I'll keep this disabled so now we have kind of one plugin within that

  27. voltage to be able to have all this kind of set up and ready to go and so in this show bl. PHP this is where we can kind of see this is a rather large um looks like I think this it's intell offense's problem I've always had a problem with uh finding specific methods if we were to like Au user is a method we know that exist um but maybe it's just because it doesn't exist in this specific class

  28. this uh this helpers class uh I don't know I I've never figured out the reason why I can or try to like ignore this but everything else looks solid it's it's really nice feel to have this and here's the benefit of this particular plugin is now I have the ability okay yes you have the formatting and you have uh the syntax highlighting and you have the prettier to be able to say okay if I was to do this like uh saving just

  29. automatically formats it because it's using pint behind the scenes it does take a little bit you can might be able to see there so I click I'm clicking save now and then it reformats this this is probably because it's using pint behind the scenes so not only are we formatting the blade uh but we're also formatting PHP up here as well but the cool thing is now you can kind of Click into some of these methods so if I was to use like authenticate user if I was

  30. to go down to authenticate user down here for example we have this wire click not only do we have autocomplete so wire click equals and then if I was to pull pull this up so let's see wire click equals and then if I was to pull this up authenticated user get listeners we have all these options right here um and then it just brings us directly to this

  31. method that's really nice on a file like this where we have a ton of lines of code so I can just pull into this wire model so anything that's that's modelable and then you still have all the click-through options for PHP as well where you have this listening party and I it directs to this particular

  32. model so all of that is incredibly nice to have and it just makes things easier I think the biggest win for me with this extension yes all of the niceties for um you know formatting is really nice I kind of already had that the biggest win for me even though yes the the autocomplete is really nice I wonder if it autocompletes with with uh alpine x show

  33. equals no that would be tough to do I feel like um but the thing that I really appreciate about um everything that this plugin brings is less about even the blade stuff and more about the PHP stuff because I have just been accustomed to within in t offence to be able to say um

  34. let's say like for this event if I was to say events and then new I think this is like um listening party I I uh Emoji reaction event so like if event new Emoji like being able to have autocomplete but then also automatic import because that doesn't exist up here or if I was to like remove it up here then we automatically have Emoji

  35. reaction event being able to import that automatically on enter I love this these options here because that is what I usually miss out on within volt and things that I often forget until I see those errors within my PHP or within my Lille um application because I'm like oh yeah I forgot to

  36. import that method or import that class that is the biggest win for me within voltage and uh if we like if we were to take a look at the voltage extension again there's so much stuff that I think Robson is kind of like looking to with this extension but I think this is going to be incredibly nice especially with the features that are going to be coming with the vs code extension from laravel

  37. as well because not only do you have these form matters within blade and bolt specifically but you have click to go auto complete syntax highlight everything for blade components and then volt and class bace so this basically takes care of at least for me everything within the blade style and now I just have intelence for everything that's in uh everywhere else and that is what the vs code extension from Lille is going to

  38. be bringing to that as well so it's nice to be able to have just everything that this provides and again the biggest thing for me is just having this be able to be set to PHP while not losing out on all of this highlighting because highlighting and formatting cuz that is the biggest win I'm curious if it's I think that's

  39. uh not only autocomplete for uh for um Live Wire but I think it's autocomplete for any kind of uh you know like blade syntax here so if I say listening maybe it's not listening party episode okay so this

  40. is not autocomplete I believe with whatever for whatever intellisense I had previously and maybe that's something that Robson is going to um incorporate eventually but I believe whatever blade uh whatever one I disabled this LEL blade formatter and maybe it was either

  41. either this um maybe it's not formatter but it might have been the blade yes Laro blade intelligence extra intelligence I wonder if I'm curious if I enable this if this will break everything now let's see uh we'll go into show so now if I go

  42. down uh because I believe this is what gave me the uh listening party okay yeah so this doesn't break any everything episode and then I have the title there and we still have formatting do I still have wire models if I had like a

  43. um wire input oops wire model there we go so we have wire model for message and and user ID yes perfect so that's still works as expected because if I was to have this button of wire click and then we have the options here so it looks like it

  44. automatically fills in with blade attributes here rather than defaulting to this yeah that might be the larl extra intellisense kind of clashing with the volt voltage component and I would imagine like things like that could be could be adjusted to be able to say okay now I have you know this with function it' be nice to also have not have

  45. options there that you know are not necessary so for example it looks like it has the method for uh mount for example but you're never going to use that within a wire model or a wire click so knowing that it's like wire pull you're never going to even like pull the mount but looks like it's it's available as a method overall and I've said it multiple times but overall I think the

  46. biggest win for me is having PHP intell enses with PHP intell offense and not having to sacrifice everything that I usually use within extensions for blade uh for blade intellisense for blade formatting for even Alpine formatting usually I would have to choose one or the other and it's a lot of times I would kind of switch back and forth between okay this file is PHP and now this file is blade but now I don't have to I think that's the biggest win for me

  47. and knowing that this is just version you know version one it was just released two weeks ago there I uh and Robson does an incredible job with all of his other projects as well so I'm excited to see what this kind of holds in the future especially with additional extensions coming out for laravel in vs code so

  48. until then give this a star bam and uh keep creating

just you here