waldo: Multi-root Workspaces in VSCode for AL Development
Youmight have figured – I’m a VSCode fanboy. One of many. You might rememberthe session I did on NAVTechDays 2017 (Rock ‘nRoll with VSCode), where I dove quite a bit intothe possibilities this great tool comes with. But I didn’t talk about the concept of “Multi-root Workspaces”: an ability of VSCodefor you to work on multiple“projects” at the same time, in one environment.
2years later, last NAVTechDays, I talkedabout Dependencies quite a lot, and when you thinkof it – in terms of dependencies in AL for BusinessCentral, these “Multi-root Workspaces” might make a lot of sense, because when youhave all these apps, you might have to work on multiple apps at the sametime.
Evenmore, in that same video, you’ll see that I ALWAYS have at least 2 apps: anapp, and its test-app. So in terms of“Test Driven Development” (a methodology I believe is indispensable), you will always have an app,and a dependent app, and you will always work on both apps at the sametime. So – “Multi Root” to therescue!
Well,the concept of “multi-root workspaces” is actually most simplyexplained by: opening multiple projects (workspaces) at the same time, to beable to work on multiple pieces of software at the same time. Or in terms of Business Central: to work (compile, publish, develop, …) on multipleapps at the same time.
Theconcept is quite well explained on the docs-page for VSCode: https://code.visualstudio.com/docs/e...oot-workspaces
The onedownside of this concept is that not every VSCode extension might be ready in aMulti-root environment. In fact, it tooka while to get my own extension (the CRS AL Language Extension) ready forMulti-root workspaces (and there still might be issues with it ;-)).
Samefor Microsoft’s AL Language Extension. It took a while – but just imagine:
Andthat’s what a real“Multi-root” experience can give you – and why I think we shouldalways look into this. It makes all thesense in the world – in a world with “lots” of apps and dependencies,to work on them simultaneously. And I’msure – if you’re not yet doing it – it can speed up your development processeven more!
May be afew screenshots that can show you how it could look like.
In thiscase, I’m actually working on 7 apps at the same time, with all of them having a test-app as well (which we use forunit-testing). The last app is theintegration-test-app.
How does it determine what app I’m working in?
Well,simply by the active editor. If I would want to compileand publish the BASE-App, I would open one of the files of that app, and simply press F5.
Symbols constantly updated over all workspaces
In mycase, the BASE App is a library-app for all other apps. And if I would simply start coding in thatBASE-App, like this useless codeunit:
Iwould – without even compiling my app – be able to code against this in any app that isdependent from that BASE-App:
Basicallymeaning: I can code against all apps at the same time, without evendownloading/updating symbols, or compiling or publishing.
Even,when you hit compile, you’ll notice that the symbol files in the.alpackages-folder are updated for all apps that depend from the app thatyou’re compiling. Very cool!
Can I control this a bit?
Well –you do have the “dependencyPublishingOption” in the launch.json,which has 3 options:
Does this mean everything needs to be in one (Git) repository?
No! VSCode is smart enough to handle multipleworkspaces at the same time. In case ofthe screenshot above – and as mentioned in a recent webcast I did about handling dependencies inDevOps – all my apps are in separate repos, together with theirTest-apps. So in case of the screenshot,it would be a collection of about 8 GIT repositories. When you switch to the “SourceControl” window, VSCode clearly shows all states of the repositories, likeyou see here in the screenshot:
You cansimply see when repos need attention (new/modified/delete files), whatbranches, and what the synchronization state is. From this window, you can obviously alsochange branches, sync, and so on.. .
Thereis more …
AndI have more for you. To make working inmultiple workspaces more easy, I’m working on a set of scripts, which you findon my PowerShell repository: https://github.com/waldo1001/Cloud.R...are.PowerShell
Iwill maintain a set of scripts in the folder ./PSScripts/NAV Extensionsv2/MultiRootWorkspaces/ . Today, I have foreseen:
Theremight be issues with the scripts – they are brand new – but please, use,abuse .. and contribute ;-).
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
|waldo: VSCode & Snippets||Blog bot||NAV: Blogs||0||20.01.2020 14:11|
|waldo: AL Extension Pack for VSCode||Blog bot||NAV: Blogs||0||02.07.2019 10:11|
|waldo: AL with VSCode: IntelliSense Fix||Blog bot||NAV: Blogs||0||22.03.2018 10:11|
|waldo: AL with VSCode: ExportToNewSyntax||Blog bot||NAV: Blogs||0||07.08.2017 04:17|
|waldo: Microsoft Dynamics NAV 2017 – what’s really new?||Blog bot||NAV: Blogs||0||13.10.2016 05:22|
|Опции темы||Поиск в этой теме|