Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diagnostics show empty parentheses if no code specified for error (regression) #78734

Closed
StephenWeatherford opened this issue Aug 8, 2019 · 3 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug candidate Issue identified as probable candidate for fixing in the next release error-list Problems view verified Verification succeeded

Comments

@StephenWeatherford
Copy link

StephenWeatherford commented Aug 8, 2019

Issue Type: Bug

Pretty sure this did not happen in 1.36.

  1. Install this extension: msazurermtools.azurerm-vscode-tools
  2. Open a .json file with these contents:
{
    "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "location": {
            "type": "string"
        }
    }
}
  1. Check issues window
    image
    Expected: The second error should not show the parentheses around an empty diagnostic code "()".
    (NOTE: The first error comes from the built-in JSON language server, the second comes from the extension)

The code that's setting the error code is here:
https://github.com/microsoft/vscode-azurearmtools/blob/e4a1b209563e4396b5ca081c6c1931d75c09d599/src/AzureRMTools.ts#L356

NOTE: Previously, if you left diagnostic.code blank, vscode would show "(0)" for the error code. Setting it to empty string seemed to be the only way to keep it from showing. But with 1.37, I've tried 0, "", undefined, null, nothing seems to allow me an empty error code without the confusing "()" showing up.

VS Code version: Code 1.37.0 (036a6b1, 2019-08-08T02:33:50.993Z)
OS version: Windows_NT x64 10.0.18362

System Info
Item Value
CPUs Intel(R) Xeon(R) W-2133 CPU @ 3.60GHz (12 x 3600)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_deferred_display_list: disabled_off
skia_renderer: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 31.73GB (17.78GB free)
Process Argv
Screen Reader no
VM 0%
Extensions (28)
Extension Author (truncated) Version
vscode-sqlite ale 0.8.0
vscode-browser-preview auc 0.5.9
azure-arm-template-helper ed- 0.0.17
tslint eg2 1.0.44
rest-client hum 0.22.0
vscode-antlr4 mik 2.1.1
azure-pipelines ms- 1.155.0
vscode-apimanagement ms- 0.1.1
vscode-azureappservice ms- 0.15.0
vscode-azurefunctions ms- 0.17.1
vscode-azurestorage ms- 0.7.1
vscode-cosmosdb ms- 0.10.2
vscode-docker ms- 0.7.0
extension-manifest-editor ms- 0.1.5
mssql ms- 1.6.0
python ms- 2019.8.29288
azure-account ms- 0.8.4
azurecli ms- 0.4.6
csharp ms- 1.21.0
powershell ms- 2019.5.0
vscode-node-azure-pack ms- 0.0.9
vscode-typescript-tslint-plugin ms- 1.2.2
azurerm-vscode-tools msa 0.6.0
arm-snippets sam 1.4.17
scope-info sie 0.2.0
tmcolor sle 0.0.1
html-preview-vscode tht 0.2.5
arm-params-generator wil 0.7.0
@vscodebot vscodebot bot added the new release label Aug 8, 2019
@sandy081 sandy081 added bug Issue identified by VS Code Team member as probable bug candidate Issue identified as probable candidate for fixing in the next release error-list Problems view labels Aug 12, 2019
@sandy081
Copy link
Member

To verify, create an extension that generate an error without code and make sure empty parenthesis are not shown

const diagnosticsCollection = vscode.languages.createDiagnosticCollection('test');
    vscode.window.onDidChangeActiveTextEditor(e => {
        if (e && e.document) {
            const diagnostics: vscode.Diagnostic[] = [];
            const diagnostic = new vscode.Diagnostic(new vscode.Range(new vscode.Position(10, 1), new vscode.Position(10, 10)), 'some error', vscode.DiagnosticSeverity.Error);
            diagnostic.source = 'test';
            diagnostics.push(diagnostic);
            diagnosticsCollection.set(e.document.uri, diagnostics);
        }
    });

@sandy081 sandy081 reopened this Aug 12, 2019
sandy081 added a commit that referenced this issue Aug 12, 2019
@sandy081 sandy081 mentioned this issue Aug 12, 2019
sandy081 added a commit that referenced this issue Aug 12, 2019
@StephenWeatherford
Copy link
Author

Thanks!

if (marker.code) {
...

Just want to verify that your intention is to not show anything if the code is set to zero instead of undefined/empty (not sure what the expected is for that).

@sandy081
Copy link
Member

Good point, but since code is string value 0 is not ignored. It is ignored only when code is empty or null or undefined.

@rebornix rebornix added the verified Verification succeeded label Aug 14, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Sep 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug candidate Issue identified as probable candidate for fixing in the next release error-list Problems view verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

3 participants