You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: don't show dub.sdl errors with missing values
Instead show just an information (blue underline), also don't show it
inside configurations or build types, since they might override existing
values to be null in that case.
description: "Additional files passed to the compiler - can be useful to add certain configuration dependent source files that are not contained in the general source folder",
506
508
values: pathComplete,
507
509
attributes: platformAttributes,
508
-
minValues: 1
510
+
minValues: 0,
511
+
suggestShouldHaveValues: true
509
512
},
510
513
sourcePaths: {
511
514
description: `Allows to customize the path where to look for source files (any folder "source" or "src" is automatically used as a source path if no sourcePaths setting is specified) - note that you usually also need to define "importPaths" as "sourcePaths" don't influence those`,
512
515
values: pathComplete,
513
516
attributes: platformAttributes,
514
-
minValues: 1
517
+
minValues: 0
518
+
// default: source, so empty is valid and not a warning
515
519
},
516
520
excludedSourceFiles: {
517
521
description: 'Files that should be removed for the set of already added source files (takes precedence over "sourceFiles" and "sourcePaths") - Glob matching can be used to pattern match multiple files at once',
518
522
values: pathComplete,
519
523
attributes: platformAttributes,
520
-
minValues: 1
524
+
minValues: 0,
525
+
suggestShouldHaveValues: true
521
526
},
522
527
mainSourceFile: {
523
528
description: 'Determines the file that contains the main() function. This setting can be used by dub to exclude this file in situations where a different main function is defined (e.g. for "dub test") - this setting does not support platform suffixes',
description: 'A list of globs matching files or directories to be copied to targetPath. Matching directories are copied recursively, i.e. "copyFiles": ["path/to/dir"]" recursively copies dir, while "copyFiles": ["path/to/dir/*"]" only copies files within dir.',
530
535
values: pathComplete,
531
536
attributes: platformAttributes,
532
-
minValues: 1
537
+
minValues: 0,
538
+
suggestShouldHaveValues: true
533
539
},
534
540
versions: {
535
541
description: "A list of D versions to be defined during compilation",
536
542
values: {
537
543
type: "string"
538
544
},
539
545
attributes: platformAttributes,
540
-
minValues: 1
546
+
minValues: 0,
547
+
suggestShouldHaveValues: true
541
548
},
542
549
debugVersions: {
543
550
description: "A list of D debug identifiers to be defined during compilation",
544
551
values: {
545
552
type: "string"
546
553
},
547
554
attributes: platformAttributes,
548
-
minValues: 1
555
+
minValues: 0,
556
+
suggestShouldHaveValues: true
549
557
},
550
558
importPaths: {
551
559
description: "Additional import paths to search for D modules (the source/ folder is used by default as a source folder, if it exists)",
552
560
values: pathComplete,
553
561
attributes: platformAttributes,
554
-
minValues: 1
562
+
minValues: 0
563
+
// default: source, so empty is valid and not a warning
555
564
},
556
565
stringImportPaths: {
557
566
description: "Additional import paths to search for string imports/views (the views/ folder is used by default as a string import folder, if it exists)",
558
567
values: pathComplete,
559
568
attributes: platformAttributes,
560
-
minValues: 1
569
+
minValues: 0
570
+
// default: views, so empty is valid and not a warning
561
571
},
562
572
preGenerateCommands: {
563
573
description: "A list of shell commands that is executed before project generation is started",
564
574
values: {
565
575
type: "string"
566
576
},
567
577
attributes: platformAttributes,
568
-
minValues: 1
578
+
minValues: 0,
579
+
suggestShouldHaveValues: true
569
580
},
570
581
postGenerateCommands: {
571
582
description: "A list of shell commands that is executed after project generation is finished",
572
583
values: {
573
584
type: "string"
574
585
},
575
586
attributes: platformAttributes,
576
-
minValues: 1
587
+
minValues: 0,
588
+
suggestShouldHaveValues: true
577
589
},
578
590
preBuildCommands: {
579
591
description: "A list of shell commands that is executed always before the project is built",
580
592
values: {
581
593
type: "string"
582
594
},
583
595
attributes: platformAttributes,
584
-
minValues: 1
596
+
minValues: 0,
597
+
suggestShouldHaveValues: true
585
598
},
586
599
postBuildCommands: {
587
600
description: "A list of shell commands that is executed always after the project is built",
588
601
values: {
589
602
type: "string"
590
603
},
591
604
attributes: platformAttributes,
592
-
minValues: 1
605
+
minValues: 0,
606
+
suggestShouldHaveValues: true
593
607
},
594
608
preRunCommands: {
595
609
description: "A list of shell commands that is executed always before the project is built",
596
610
values: {
597
611
type: "string"
598
612
},
599
613
attributes: platformAttributes,
600
-
minValues: 1
614
+
minValues: 0,
615
+
suggestShouldHaveValues: true
601
616
},
602
617
postRunCommands: {
603
618
description: "A list of shell commands that is executed always after the project is built",
604
619
values: {
605
620
type: "string"
606
621
},
607
622
attributes: platformAttributes,
608
-
minValues: 1
623
+
minValues: 0,
624
+
suggestShouldHaveValues: true
609
625
},
610
626
environments: {
611
627
description: "Environment variables to pass to every invoked build tool, program or script. (lowest precedence)\n\n```\nenvironments \"key\" \"value\"\n```",
@@ -713,6 +729,24 @@ function merge(a: OptionalCompletionTagMap, b: OptionalCompletionTagMap): Comple
@@ -1063,6 +1097,9 @@ export class SDLContributions implements vscode.CompletionItemProvider {
1063
1097
if(typeofobj.minValues=="number")
1064
1098
if(tag.values.length<obj.minValues&&tag.range)
1065
1099
errors.push(newvscode.Diagnostic(range(tag.range),"Not enough values. Requires at least "+obj.minValues,vscode.DiagnosticSeverity.Error));
1100
+
if(obj.suggestShouldHaveValues)
1101
+
if(tag.values.length==0&&tag.range)
1102
+
errors.push(newvscode.Diagnostic(range(tag.range),"This directive should specify some values, otherwise it might not have any effect",vscode.DiagnosticSeverity.Information));
1066
1103
if(typeofobj.maxValues=="number")
1067
1104
if(tag.values.length>obj.maxValues&&tag.range)
1068
1105
errors.push(newvscode.Diagnostic(range(tag.range),"Too many values. Allows at most "+obj.maxValues,vscode.DiagnosticSeverity.Error));
0 commit comments