VSCode Multiple-Folder Workspace Search references - visual-studio-code

Going through a project that start to be quite huge, we've got a workspace with 10+ folders.
Into those 10+ folders we have 9 folders that have the same code base in Node.js & the 10th one that is a private NPM package that we build and that all 9 others rely on.
We're trying to make things easier for all the devs to find some other usage of a function they want to explore and for that, we wanted to be able to find some function references / implementations across all the folders of the workspace.
For instance, if I go in one of the folder, in one of the source file :
and I right-click on the authorize method that is custom and implemented into the NPM private package. If I look up for References I'll get results like this :
But those are only the result of the reference of this method into this folder and not into others project that also use this express middleware.
You can see that I also get the result of the dist folder of the NPM package which seems logical but also seems to be the problem that I am facing.
I don't really know what can also be useful so feel free to ask me any kind of content and find attached the workspace configuration :
{
"folders": [
{
"name": "Docs",
"path": "./repositories/Docs"
},
{
"name": "Frontend",
"path": "./repositories/project_pwa"
},
{
"name": "Service A",
"path": "./repositories/project_A"
},
{
"name": "Service B",
"path": "./repositories/project_B"
},
{
"name": "Project C",
"path": "./repositories/project_C"
},
{
"name": "Project D",
"path": "./repositories/project_D"
},
{
"name": "Project E",
"path": "./repositories/project_E"
},
{
"name": "Project F",
"path": "./repositories/project_F"
},
{
"name": "Project G",
"path": "./repositories/project_G"
},
{
"name": "Project H",
"path": "./repositories/project_H"
},
{
"name": "project I",
"path": "./repositories/project_I"
},
{
"name": "Project J",
"path": "./repositories/project_J"
},
{
"name": "Project K",
"path": "./repositories/project_K"
},
{
"path": "./repositories/project_L",
"name": "Project L"
},
{
"path": ".",
"name": "Master"
}
],
"settings": {
"markdown.extension.print.imgToBase64": true,
"editor.multiCursorModifier": "alt",
"editor.renderWhitespace": "boundary",
"editor.wordWrap": "on",
"diffEditor.ignoreTrimWhitespace": false,
"git.autofetch": true,
"markdown.extension.print.absoluteImgPath": false,
"markdown.extension.print.validateUrls": false,
"markdown.extension.toc.levels": "2..6",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"files.exclude": {
"node_modules": true,
"dist": true,
"repositories": true
},
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"[javascript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"editor.tabSize": 2,
},
"extensions": {
"recommendations": [
"yzhang.markdown-all-in-one",
"stamminger.vscode-markdown-preview-include",
"DavidAnson.vscode-markdownlint",
"Arjun.swagger-viewer",
"bierner.markdown-checkbox",
"bierner.markdown-mermaid",
"christian-kohler.path-intellisense",
"dbaeumer.vscode-eslint",
"eamodio.gitlens",
"esbenp.prettier-vscode",
"FredJeck.fav",
"markvincze.code-fragments",
"mhutchie.git-graph",
"mikeburgh.xml-format",
"ms-vscode.js-debug",
"ms-vscode.references-view",
"ms-vscode.vscode-js-profile-table",
"ms-vsliveshare.vsliveshare",
"redhat.vscode-yaml",
"telesoho.vscode-markdown-paste-image",
"vespa-dev-works.jestRunIt",
"VisualStudioExptTeam.vscodeintellicode"
]
}
}

Related

Why does VSCode not highlight anything when I use this textMate?

I am writing a logic gate simulator and have decided to make a VSCode extension for the language it uses. So far, I have a folder named lgc that contains the extension. Inside that folder there are the following:
package.json:
{
"name": "Lgc",
"version": "0.1.0",
"engines": {
"vscode": ">=0.9.0-pre.1"
},
"publisher": "AwesomeCronk",
"contributes": {
"languages": [{
"id": "lgc",
"aliases": ["lgc", "Lgc", "LGC"],
"extensions": [".lgc",".ttb"]
}],
"grammars": [{
"language": "lgc",
"scopeName": "source.lgc",
"path": "./syntaxes/lgc.tmLanguage.json"
}]
}
}
syntaxes/lgc.tmLanguage.json:
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "Lgc",
"patterns": [
{
"include": "#keywords"
}
],
"repository":
{
"keywords":
{
"paterns":
[
{
"name:": "keyword.gate.lgc",
"match": "a"
}
]
}
},
"scopeName": "source.lgc"
}
This is a test that should highlight any instance of the letter a as keywords. When I copy this folder to $Home/.vscode/extensions/, and restart VSCode with a .lgc file open, it is not highlighted at all. All the text is white. The status bar shows lgc as the language, so I know VSCode is detecting the language properly. Why doesn't it highlight?
I think you have a typo in your syntaxes/lgc.tmLanguage.json file:
"paterns":
Should be:
"patterns":

Azure DevOps Server 2019: Custom Dashboard Widget not available

We have a self-hosted Azure DevOps Server 2019 for which I have created my own widget using the tutorial https://learn.microsoft.com/en-us/azure/devops/extend/develop/add-dashboard-widget?view=azure-devops-2019.
I was also able to successfully add the extension to the server and the extension is also visible.
However, when I edit my dashboard, my newly created widget is not displayed. What could be the reason for this?
Furthermore, I also installed the extension VstsDashboardWidgetProjectTemplate (https://github.com/GregTrevellick/VstsDashboardWidgetProjectTemplate) in Visual Studio and also created an extension/widget from it. Unfortunately with the same result that I can install and see the extension, but not the actual widget.
I am attaching the vss-extension.json file as I suspect this is where the error is most likely to be found. However, I can also supply the other files if needed.
{
"manifestVersion": 1,
"id": "MyVeryFirstCustomExtension",
"version": "1.0.0",
"name": "My Very First Custom Extension",
"description": "Samples containing different widgets extending dashboards",
"publisher": "MyCompany",
"categories": [
"Azure Boards"
],
"targets": [
{
"id": "Microsoft.VisualStudio.Services"
}
],
"icons": {
"default": "img/logo.png"
},
"contributions": [
{
"id": "HelloWorldWidget",
"type": "ms.vss-dashboards-web.widget",
"targets": [
"ms.vss-dashboards-web.widget-catalog"
],
"properties": {
"name": "Hello World Widget",
"description": "My first widget",
"catalogIconUrl": "img/CatalogIcon.png",
"previewImageUrl": "img/preview.png",
"uri": "hello-world.html",
"supportedSizes": [
{
"rowSpan": 1,
"columnSpan": 2
}
],
"supportedScopes": [
"project_team"
]
}
}
],
"files": [
{
"path": "hello-world.html",
"addressable": true
},
{
"path": "sdk/scripts",
"addressable": true
},
{
"path": "img",
"addressable": true
}
],
"scopes": [
"vso.work"
]
}

I can't hide the browser bar on TWA

if anyone can help me with my problem thank you, i will explain better.
I am trying to remove the browser bar from the top of my TWA, I have tried several things I read on the internet but so far nothing.
I already created the file "assetlinks.json" with my two fingerprints, both the app signature and the upload signature.
And yet the browser bar appears at the top of my application.
Here is the link to my "assetlinks.json":
https://app.planetspay.com.br/.well-known/assetlinks.json
Follow my application's link on Google Play:
https://play.google.com/store/apps/details?id=app.planetsplay.com.br
Here is my TWA-manifest.json file:
{
"packageId": "app.planetsplay.com.br",
"host": "app.planetspay.com.br",
"name": "PlanetsPay",
"launcherName": "PlanetsPay",
"display": "standalone",
"themeColor": "#16A591",
"navigationColor": "#16A591",
"navigationColorDark": "#16A591",
"navigationDividerColor": "#16A591",
"navigationDividerColorDark": "#16A591",
"backgroundColor": "#FFFFFF",
"enableNotifications": true,
"startUrl": "/logar?ref=twa",
"iconUrl": "https://app.planetspay.com.br/img/icone-app.png",
"splashScreenFadeOutDuration": 0,
"signingKey": {
"path": "F:\\RubensFlinco-PC\\Documents\\Github\\PlanetsPay-Aplicativo\\android.keystore",
"alias": "android"
},
"appVersionName": "2",
"appVersionCode": 2,
"shortcuts": [
{
"name": "Meu QRCode",
"shortName": "QRCode",
"url": "https://app.planetspay.com.br/qrcode?twa=true&utm_source=shortcuts",
"chosenIconUrl": "https://app.planetspay.com.br/img/icons/qrcode.png"
},
{
"name": "Emitir cobrança",
"shortName": "Cobrar",
"url": "https://app.planetspay.com.br/pessoal/cobrar?twa=true&utm_source=shortcuts",
"chosenIconUrl": "https://app.planetspay.com.br/img/icons/cobrar.png"
},
{
"name": "Transferir dinheiro",
"shortName": "Transferir",
"url": "https://app.planetspay.com.br/pessoal/dinheiro/transferir?twa=true&utm_source=shortcuts",
"chosenIconUrl": "https://app.planetspay.com.br/img/icons/transferir.png"
},
{
"name": "Ver meu extrato",
"shortName": "Extrato",
"url": "https://app.planetspay.com.br/pessoal/extrato?twa=true&utm_source=shortcuts",
"chosenIconUrl": "https://app.planetspay.com.br/img/icons/extrato.png"
}
],
"generatorApp": "bubblewrap-cli",
"webManifestUrl": "https://app.planetspay.com.br/manifest.json",
"fallbackType": "customtabs",
"features": {},
"alphaDependencies": {
"enabled": false
},
"enableSiteSettingsShortcut": false,
"isChromeOSOnly": false,
"orientation": "portrait",
"fingerprints": [],
"appVersion": "2"
}
I discovered that it was my typo in the package name

How to use multiple tmLanguage files in vscode extension

I am creating a language extension in vscode for myself. Because it will associate with different file types, I plan to make different tmlanguge files for specific rules. According to this, I could extend the scopeName to achieve that.
So I created in my ./package.json files something like this:
{
"name": "tst",
"displayName": "Test Language",
"description": "A test for language extension",
"version": "0.0.1",
"engines": {
"vscode": "^1.34.0"
},
"contributes": {
"languages": [{
"id": "tst",
"aliases": ["Test", "tst"],
"extensions": [".tst",".type1",".type2"],
"configuration": "./language-configuration.json"
}],
"grammars": [{
"language": "tst",
"scopeName": "source.tst",
"path": "./syntaxes/tst.tmLanguage.json"
},
{
"scopeName": "source.tst.type1",
"path": "./syntaxes/type1.tmLanguage.json"
},
{
"scopeName": "source.tst.type2",
"path": "./syntaxes/type2.tmLanguage.json"
}]
}
}
Then I create the base rules in ./syntaxes/tst.tmLanguage.json and both .type1 and .type2 have been applied with my grammars.
{
"name": "Test",
"patterns": [
{
"match": "test",
"name": "constant.character"
}
],
"scopeName": "source.tst"
}
Afterwards I also make ./syntaxes/type1.tmLanguage.json something like this:
{
"name": "type1",
"patterns": [
{
"match": "type1",
"name": "constant.language"
}
],
"scopeName": "source.tst.type1"
}
Nothing works for any rules in .type1.
I hope both file in the picture can recognize test and type1.
I checked the vscode pre-installed cpp language extension.
They also use scopeName for source.c and source.c.platform.
I guess it is for the similar purpose?
Did I overlook something?
Thanks for the help.
If you want to use these scopes from different tmLanguage files in the main grammar, you have to explicitly include them:
{
"name": "Test",
"patterns": [
{
"match": "test",
"name": "constant.character"
},
{
"include": "source.tst.type1"
},
{
"include": "source.tst.type2"
}
],
"scopeName": "source.tst"
}
Regarding the built-in cpp extension and platform.tmLanguage.json - as far as I can tell, it's not actively being used by the c and cpp grammars. There's this comment in cpp/build/update-grammars.js:
// `source.c.platform` which is still included by other grammars
So that sounds more like a backwards-compatibility measure in case any third-party grammars still use it.

Write initial settings to settings.json

I am looking for a way to write initial settings to settings.json for when my extension is installed.
I found WorkspaceConfiguration API, but that seems to retrieving/updating values at runtime.
I'm looking to get my settings + comments into the default settings file
e.g. How TSLint does it:
I hope I get your question correctly: I assume you mean the User Settings settings.json you can get via File>Preferences>User Settings.
If you know that TSLint does it, you can go to your extensions folder (windows: $USERFOLDER/.vscode/extensions), pick the extension (in my case it was the folder "eg2.tslint-0.6.7") and peek the files.
...
"contributes": {
"configuration": {
"type": "object",
"title": "TSLint",
"properties": {
"tslint.enable": {
"type": "boolean",
"default": true,
"description": "Control whether tslint is enabled for TypeScript files or not."
},
"tslint.rulesDirectory": {
"type": [
"string",
"array"
],
"items": {
"type": "string"
},
"description": "An additional rules directory",
"default": ""
},
"tslint.validateWithDefaultConfig": {
"type": "boolean",
"description": "Validate a file when there is only a default tslint configuration is found",
"default": false
},
"tslint.configFile": {
"type": "string",
"description": "The path to the rules configuration file",
"default": ""
},
"tslint.ignoreDefinitionFiles": {
"type": "boolean",
"default": true,
"description": "Control if TypeScript definition files should be ignored"
},
"tslint.exclude": {
"type": [
"string",
"array"
],
"items": {
"type": "string"
},
"description": "Configure glob patterns of file paths to exclude from linting"
},
"tslint.run": {
"type": "string",
"enum": [
"onSave",
"onType"
],
"default": "onType",
"description": "Run the linter on save (onSave) or on type (onType)"
},
"tslint.nodePath": {
"type": "string",
"default": "",
"description": "A path added to NODE_PATH when resolving the tslint module."
},
"tslint.autoFixOnSave": {
"type": "boolean",
"default": false,
"description": "Turns auto fix on save on or off."
}
}
}
...
Hope this helps