[{"data":1,"prerenderedAt":-1,"buildId":728},["ShallowReactive",2],{"$9oPIbGgjrk":3,"blog-\u002Fblog\u002Fmy-first-vs-code-extension":52,"blog-similar-posts-\u002Fblog\u002Fmy-first-vs-code-extension":458,"blog-surrounding-\u002Fblog\u002Fmy-first-vs-code-extension":479,"blogToc-\u002Fblog\u002Fmy-first-vs-code-extension":484},{"id":4,"extension":5,"items":6,"meta":49,"stem":50,"__hash__":51},"menu\u002Fmenu.json","json",[7,12,16,20,24,28,32,36,41,45],{"i18nId":8,"to":9,"ariaLabel":10,"mainNavigation":11},"components.menu.home","\u002F","Home",true,{"i18nId":13,"to":14,"ariaLabel":15,"mainNavigation":11},"components.menu.about","\u002Fhire-me","About",{"i18nId":17,"to":18,"ariaLabel":19,"mainNavigation":11},"components.menu.testimonials","\u002Ftestimonials","Testimonials",{"i18nId":21,"to":22,"ariaLabel":23},"components.menu.contact","\u002Fcontact","Contact",{"i18nId":25,"to":26,"ariaLabel":27,"mainNavigation":11},"components.menu.blog","\u002Fblog","Blog",{"i18nId":29,"to":30,"ariaLabel":31,"mainNavigation":11},"components.menu.tips","\u002Fvue-tips","Vue Tips",{"i18nId":33,"to":34,"ariaLabel":35,"mainNavigation":11},"components.menu.projects","\u002Fprojects","Projects",{"i18nId":37,"to":38,"ariaLabel":39,"mainNavigation":40},"components.menu.stats","\u002Fstats","stats",false,{"i18nId":42,"to":43,"ariaLabel":44,"mainNavigation":40},"components.menu.businessCard","\u002Fbusiness-card","Business Card",{"i18nId":46,"to":47,"ariaLabel":48,"mainNavigation":40},"components.menu.publications","\u002Fpublications","Publications",{},"menu","njLT1QoRt2Dv8QWoVmH8xdTAiDywSj0bxBQdmoyWUE0",{"id":53,"title":54,"body":55,"categories":437,"cover":332,"date":439,"description":440,"extension":441,"lastUpdated":442,"meta":443,"navigation":11,"ogImage":442,"path":445,"readingTime":446,"robots":442,"schemaOrg":442,"seo":451,"sitemap":452,"stem":456,"tags":442,"__hash__":457},"blog\u002Fblog\u002Fmy-first-vs-code-extension\u002Findex.md","My First Visual Code Extension",{"type":56,"value":57,"toc":426},"minimark",[58,76,79,84,117,123,135,140,148,151,155,158,173,178,187,202,211,315,318,323,326,333,336,339,360,363,369,373,388,396,400,403,407,422],[59,60,61,62,69,70,75],"p",{},"I am a big fan of ",[63,64,68],"a",{"href":65,"rel":66},"https:\u002F\u002Fcode.visualstudio.com",[67],"nofollow","Visual Code"," and use it as my main IDE for software development. The available selection of extensions (see the ",[63,71,74],{"href":72,"rel":73},"https:\u002F\u002Fmarketplace.visualstudio.com\u002FVSCode",[67],"Extension Marketplace",") is amazing.",[59,77,78],{},"As I started using Visual Code I found every extension I was looking for. Last week I stumbled upon a feature for which I could not find an extension. So I decided to write my first VS code extension and let you know about my experiences during the development.",[80,81,83],"h2",{"id":82},"the-problem-i-wanted-to-solve","The problem I wanted to solve",[59,85,86,87,92,93,98,99,104,105,110,111,116],{},"Currently, I am doing a lot of ",[63,88,91],{"href":89,"rel":90},"https:\u002F\u002Fangular.io\u002F",[67],"Angular"," development and therefore use ",[63,94,97],{"href":95,"rel":96},"https:\u002F\u002Fjasmine.github.io\u002F",[67],"Jasmine"," for unit tests. My first IDE, which I used for web development was ",[63,100,103],{"href":101,"rel":102},"https:\u002F\u002Fwww.jetbrains.com\u002Fwebstorm\u002F",[67],"WebStorm"," which is based on ",[63,106,109],{"href":107,"rel":108},"https:\u002F\u002Fwww.jetbrains.com\u002Fidea\u002F",[67],"IntelliJ IDEA",". In WebStorm, I often used and liked the plugin ",[63,112,115],{"href":113,"rel":114},"https:\u002F\u002Fgithub.com\u002Fandresdominguez\u002Fddescriber",[67],"ddescriber"," for Jasmine tests:",[118,119,120],"blockquote",{},[59,121,122],{},"Intellij plugin to quickly transform a JavaScript test block from describe() to ddescribe() and a test it() into iit()",[59,124,125,126,130,131,134],{},"This is a nice feature, but I often used the plugin to list all available specs and then jump to a certain ",[127,128,129],"code",{},"describe()"," or ",[127,132,133],{},"it()"," block:",[118,136,137],{},[59,138,139],{},"Just type Ctrl + Shift + D (Command + Shift + D on a Mac) to launch a dialog that lets you choose which suites or unit tests you want to include or exclude.",[59,141,142,143,130,145,147],{},"This is useful in large unit tests which includes many ",[127,144,129],{},[127,146,133],{}," blocks.",[59,149,150],{},"As I could not find a VS code extension that solves this problem, I decided to write my first own VS code extension.",[80,152,154],{"id":153},"what-the-extension-should-handle","What the extension should handle",[59,156,157],{},"The first version of the extension should be able to:",[159,160,161,170],"ul",{},[162,163,164,165,130,167,169],"li",{},"List all ",[127,166,129],{},[127,168,133],{}," blocks as dropdown in an opened file in the editor",[162,171,172],{},"If a block is selected, move the cursor to this block",[174,175,177],"h3",{"id":176},"how-to-start","How to start?",[59,179,180,181,186],{},"Big applause to the VS code team for the amazing ",[63,182,185],{"href":183,"rel":184},"https:\u002F\u002Fcode.visualstudio.com\u002Fdocs\u002Fextensions\u002Foverview",[67],"documentation"," on how to build your own VS code extension.",[59,188,189,190,195,196,201],{},"It is straightforward to grab one of the example projects or create a new one using ",[63,191,194],{"href":192,"rel":193},"https:\u002F\u002Fcode.visualstudio.com\u002Fdocs\u002Fextensions\u002Fyocode",[67],"Extension Generator"," and get started. Additionally, it is very easy to ",[63,197,200],{"href":198,"rel":199},"https:\u002F\u002Fcode.visualstudio.com\u002Fdocs\u002Fextensions\u002Fdeveloping-extensions#_running-and-debugging-your-extension",[67],"run and debug your new extension",".",[59,203,204,205,210],{},"Searching through the ",[63,206,209],{"href":207,"rel":208},"https:\u002F\u002Fcode.visualstudio.com\u002Fdocs\u002FextensionAPI\u002Foverview",[67],"Extension API documentation"," I found this method",[212,213,218],"pre",{"className":214,"code":215,"language":216,"meta":217,"style":217},"language-ts shiki shiki-themes github-light poimandres poimandres","showQuickPick\u003CT extends QuickPickItem>(items: T[] | Thenable\u003CT[]>, options?: QuickPickOptions, token?: CancellationToken): Thenable\u003CT | undefined>\n","ts","",[127,219,220],{"__ignoreMap":217},[221,222,225,229,233,237,241,244,247,251,255,258,261,264,267,269,271,274,277,280,283,286,289,291,294,297,299,301,303,305,308,312],"span",{"class":223,"line":224},"line",1,[221,226,228],{"class":227},"sMzB8","showQuickPick",[221,230,232],{"class":231},"sygvE","\u003C",[221,234,236],{"class":235},"s4XUm","T",[221,238,240],{"class":239},"sRZEA"," extends",[221,242,243],{"class":235}," QuickPickItem",[221,245,246],{"class":231},">(",[221,248,250],{"class":249},"sadQ_","items",[221,252,254],{"class":253},"slWGy",":",[221,256,257],{"class":235}," T",[221,259,260],{"class":231},"[] ",[221,262,263],{"class":253},"|",[221,265,266],{"class":235}," Thenable",[221,268,232],{"class":231},[221,270,236],{"class":235},[221,272,273],{"class":231},"[]>, ",[221,275,276],{"class":249},"options",[221,278,279],{"class":253},"?:",[221,281,282],{"class":235}," QuickPickOptions",[221,284,285],{"class":231},", ",[221,287,288],{"class":249},"token",[221,290,279],{"class":253},[221,292,293],{"class":235}," CancellationToken",[221,295,296],{"class":231},")",[221,298,254],{"class":253},[221,300,266],{"class":235},[221,302,232],{"class":231},[221,304,236],{"class":235},[221,306,307],{"class":253}," |",[221,309,311],{"class":310},"svhIC"," undefined",[221,313,314],{"class":231},">\n",[59,316,317],{},"which functionality is described as:",[118,319,320],{},[59,321,322],{},"Shows a selection list allowing multiple selections.",[59,324,325],{},"It looks this way in VS code if it is called:",[59,327,328],{},[329,330],"img",{"alt":331,"src":332},"VS Code Quick Pick Screenshot","blog\u002Fmy-first-vs-code-extension\u002Fjasmine-test-selector_iquirk.png",[59,334,335],{},"So this sounded like an excellent opportunity to list all test blocks and provide a way to receive the selected value.",[59,337,338],{},"So basically, I had to implement these steps:",[159,340,341,351,357],{},[162,342,343,344,130,347,350],{},"Grab all strings in the opened editor, which include ",[127,345,346],{},"it(",[127,348,349],{},"describe("," and the corresponding line number of this string.",[162,352,353,354,356],{},"Pass them to ",[127,355,228],{}," method.",[162,358,359],{},"Receive the selection and move the cursor to the corresponding line number.",[59,361,362],{},"The final output for a Jasmine test file looks like this:",[59,364,365],{},[329,366],{"alt":367,"src":368},"VS Code Jasmine Test Selector Screenshot","blog\u002Fmy-first-vs-code-extension\u002Fvs-code-quick-pick_mxoayz.jpg",[174,370,372],{"id":371},"publishing-the-extension","Publishing the extension",[59,374,375,376,381,382,387],{},"Another lovely experience was the straightforward publishing process for VS code extensions. Basically, I followed the ",[63,377,380],{"href":378,"rel":379},"https:\u002F\u002Fcode.visualstudio.com\u002Fdocs\u002Fextensions\u002Fpublish-extension",[67],"official documentation",", which requires a ",[63,383,386],{"href":384,"rel":385},"https:\u002F\u002Fdocs.microsoft.com\u002Fvsts\u002Faccounts\u002Fcreate-account-msa-or-work-student",[67],"Visual Studio Team Services"," account.",[59,389,390,391,201],{},"The published extension is available in the ",[63,392,395],{"href":393,"rel":394},"https:\u002F\u002Fmarketplace.visualstudio.com\u002Fitems?itemName=Mokkapps.jasmine-test-selector#overview",[67],"Visual Studio Code Marketplace",[80,397,399],{"id":398},"conclusion","Conclusion",[59,401,402],{},"In summary, it made a lot of fun to develop a VS code experience. The documentation and examples are excellent, and I am thrilled that I added a functionality to my favorite code editor, which I've been missing.",[80,404,406],{"id":405},"links","Links",[159,408,409,415],{},[162,410,411],{},[63,412,414],{"href":393,"rel":413},[67],"Download the extension from the marketplace",[162,416,417],{},[63,418,421],{"href":419,"rel":420},"https:\u002F\u002Fgithub.com\u002FMokkapps\u002Fjasmine-test-selector",[67],"Source code on GitHub",[423,424,425],"style",{},"html pre.shiki code .sMzB8, html code.shiki .sMzB8{--shiki-light:#24292E;--shiki-default:#E4F0FB;--shiki-dark:#E4F0FB}html pre.shiki code .sygvE, html code.shiki .sygvE{--shiki-light:#24292E;--shiki-default:#A6ACCD;--shiki-dark:#A6ACCD}html pre.shiki code .s4XUm, html code.shiki .s4XUm{--shiki-light:#6F42C1;--shiki-default:#A6ACCDC0;--shiki-dark:#A6ACCDC0}html pre.shiki code .sRZEA, html code.shiki .sRZEA{--shiki-light:#D73A49;--shiki-default:#5DE4C7;--shiki-dark:#5DE4C7}html pre.shiki code .sadQ_, html code.shiki .sadQ_{--shiki-light:#E36209;--shiki-default:#E4F0FB;--shiki-dark:#E4F0FB}html pre.shiki code .slWGy, html code.shiki .slWGy{--shiki-light:#D73A49;--shiki-default:#91B4D5;--shiki-dark:#91B4D5}html pre.shiki code .svhIC, html code.shiki .svhIC{--shiki-light:#005CC5;--shiki-default:#A6ACCDC0;--shiki-dark:#A6ACCDC0}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":217,"searchDepth":427,"depth":427,"links":428},2,[429,430,435,436],{"id":82,"depth":427,"text":83},{"id":153,"depth":427,"text":154,"children":431},[432,434],{"id":176,"depth":433,"text":177},3,{"id":371,"depth":433,"text":372},{"id":398,"depth":427,"text":399},{"id":405,"depth":427,"text":406},[438],"development","2018-05-11","I am a big fan of Visual Code and use it as my main IDE for software development. The available selection of extensions (see the Extension Marketplace) is amazing.","md",null,{"subTitle":444},"My little journey developing my first VS Code extension","\u002Fblog\u002Fmy-first-vs-code-extension",{"text":447,"minutes":448,"time":449,"words":450},"3 min read",2.565,153900,513,{"title":54,"description":440},{"loc":445,"images":453,"lastmod":439},[454,455],{"loc":332},{"loc":368},"blog\u002Fmy-first-vs-code-extension\u002Findex","BYcmwLwkctsO_Bb_zptNQstQjF6OekbDZ2T31Ax4KN0",[459,464,469,474],{"cover":460,"date":461,"slug":462,"title":463,"to":462},"blog\u002Fa-comprehensive-guide-to-data-fetching-in-nuxt-3\u002Fog.png","2023-06-20","\u002Fblog\u002Fa-comprehensive-guide-to-data-fetching-in-nuxt-3","A Comprehensive Guide to Data Fetching in Nuxt 3",{"cover":465,"date":466,"slug":467,"title":468,"to":467},"blog\u002Fanalyze-memory-leaks-in-your-nuxt-app\u002Fog.png","2024-07-27","\u002Fblog\u002Fanalyze-memory-leaks-in-your-nuxt-app","Analyze Memory Leaks in Your Nuxt App",{"cover":470,"date":471,"slug":472,"title":473,"to":472},"blog\u002Fbuild-and-deploy-a-serverless-graphql-react-app-using-aws-amplify\u002Fcover_pliu6q.jpg","2021-05-07","\u002Fblog\u002Fbuild-and-deploy-a-serverless-graphql-react-app-using-aws-amplify","Build and Deploy a Serverless GraphQL React App Using AWS Amplify",{"cover":475,"date":476,"slug":477,"title":478,"to":477},"blog\u002Fbuilding-a-polite-newsletter-popup-with-nuxt-3\u002FBlog_Post__Polite_Popup_Nuxt_3_k8ch1w.jpg","2022-10-18","\u002Fblog\u002Fbuilding-a-polite-newsletter-popup-with-nuxt-3","Building a Polite Newsletter Popup With Nuxt 3",[480,442],{"title":481,"path":482,"stem":483,"children":-1},"My First NPM Package: github-traffic-cli","\u002Fblog\u002Fmy-first-npm-package","blog\u002Fmy-first-npm-package\u002Findex",{"id":485,"title":54,"body":486,"cover":332,"date":439,"description":440,"extension":441,"meta":719,"navigation":11,"path":445,"robots":442,"seo":722,"sitemap":723,"stem":456,"__hash__":727},"content\u002Fblog\u002Fmy-first-vs-code-extension\u002Findex.md",{"type":56,"value":487,"toc":710},[488,496,498,500,517,521,527,531,537,539,541,543,553,555,560,568,573,639,641,645,647,651,653,655,669,671,675,677,685,690,692,694,696,708],[59,489,61,490,69,493,75],{},[63,491,68],{"href":65,"rel":492},[67],[63,494,74],{"href":72,"rel":495},[67],[59,497,78],{},[80,499,83],{"id":82},[59,501,86,502,92,505,98,508,104,511,110,514,116],{},[63,503,91],{"href":89,"rel":504},[67],[63,506,97],{"href":95,"rel":507},[67],[63,509,103],{"href":101,"rel":510},[67],[63,512,109],{"href":107,"rel":513},[67],[63,515,115],{"href":113,"rel":516},[67],[118,518,519],{},[59,520,122],{},[59,522,125,523,130,525,134],{},[127,524,129],{},[127,526,133],{},[118,528,529],{},[59,530,139],{},[59,532,142,533,130,535,147],{},[127,534,129],{},[127,536,133],{},[59,538,150],{},[80,540,154],{"id":153},[59,542,157],{},[159,544,545,551],{},[162,546,164,547,130,549,169],{},[127,548,129],{},[127,550,133],{},[162,552,172],{},[174,554,177],{"id":176},[59,556,180,557,186],{},[63,558,185],{"href":183,"rel":559},[67],[59,561,189,562,195,565,201],{},[63,563,194],{"href":192,"rel":564},[67],[63,566,200],{"href":198,"rel":567},[67],[59,569,204,570,210],{},[63,571,209],{"href":207,"rel":572},[67],[212,574,575],{"className":214,"code":215,"language":216,"meta":217,"style":217},[127,576,577],{"__ignoreMap":217},[221,578,579,581,583,585,587,589,591,593,595,597,599,601,603,605,607,609,611,613,615,617,619,621,623,625,627,629,631,633,635,637],{"class":223,"line":224},[221,580,228],{"class":227},[221,582,232],{"class":231},[221,584,236],{"class":235},[221,586,240],{"class":239},[221,588,243],{"class":235},[221,590,246],{"class":231},[221,592,250],{"class":249},[221,594,254],{"class":253},[221,596,257],{"class":235},[221,598,260],{"class":231},[221,600,263],{"class":253},[221,602,266],{"class":235},[221,604,232],{"class":231},[221,606,236],{"class":235},[221,608,273],{"class":231},[221,610,276],{"class":249},[221,612,279],{"class":253},[221,614,282],{"class":235},[221,616,285],{"class":231},[221,618,288],{"class":249},[221,620,279],{"class":253},[221,622,293],{"class":235},[221,624,296],{"class":231},[221,626,254],{"class":253},[221,628,266],{"class":235},[221,630,232],{"class":231},[221,632,236],{"class":235},[221,634,307],{"class":253},[221,636,311],{"class":310},[221,638,314],{"class":231},[59,640,317],{},[118,642,643],{},[59,644,322],{},[59,646,325],{},[59,648,649],{},[329,650],{"alt":331,"src":332},[59,652,335],{},[59,654,338],{},[159,656,657,663,667],{},[162,658,343,659,130,661,350],{},[127,660,346],{},[127,662,349],{},[162,664,353,665,356],{},[127,666,228],{},[162,668,359],{},[59,670,362],{},[59,672,673],{},[329,674],{"alt":367,"src":368},[174,676,372],{"id":371},[59,678,375,679,381,682,387],{},[63,680,380],{"href":378,"rel":681},[67],[63,683,386],{"href":384,"rel":684},[67],[59,686,390,687,201],{},[63,688,395],{"href":393,"rel":689},[67],[80,691,399],{"id":398},[59,693,402],{},[80,695,406],{"id":405},[159,697,698,703],{},[162,699,700],{},[63,701,414],{"href":393,"rel":702},[67],[162,704,705],{},[63,706,421],{"href":419,"rel":707},[67],[423,709,425],{},{"title":217,"searchDepth":427,"depth":427,"links":711},[712,713,717,718],{"id":82,"depth":427,"text":83},{"id":153,"depth":427,"text":154,"children":714},[715,716],{"id":176,"depth":433,"text":177},{"id":371,"depth":433,"text":372},{"id":398,"depth":427,"text":399},{"id":405,"depth":427,"text":406},{"subTitle":444,"categories":720,"readingTime":721},[438],{"text":447,"minutes":448,"time":449,"words":450},{"title":54,"description":440},{"loc":445,"images":724,"lastmod":439},[725,726],{"loc":332},{"loc":368},"0zJsV8kNT88Ell5zFRioP0yDnkfaa_bUjeI_4NaXY2o","f09a107e-6bfe-401d-aab9-d94cb6f394d2"]