Example #1
0
        public void WarningLocation_Differs_FileName()
        {
            var warningLocationOne = new WarningLocation("Foo", "Foo", new SourceSpan(1, 2));
            var warningLocationTwo = new WarningLocation("Bar", "Bar", new SourceSpan(1, 2));

            Assert.NotEqual(warningLocationOne, warningLocationTwo);
        }
Example #2
0
        public void WarningLocation_Equals()
        {
            var warningLocationOne = new WarningLocation("Foo", "Foo", new SourceSpan(1, 2));
            var warningLocationTwo = new WarningLocation("Foo", "Foo", new SourceSpan(1, 2));

            Assert.NotSame(warningLocationOne, warningLocationTwo);
            Assert.Equal(warningLocationOne, warningLocationTwo);
        }
Example #3
0
        public void Execute()
        {
            string fileLocation = FileStorage.CreateFile();

            WarningLocation warningLocation = _warningsController.GetSelectedWarning();

            File.WriteAllText($"{fileLocation}Warnings.json", JsonConvert.SerializeObject(warningLocation.GetWarnings()));
        }
Example #4
0
 private void ReportWarning(WarningID id, WarningLocation location, string value, string message)
 => SourceFile.ParsingResult.ParserWarnings.Add(
     new Warning(
         id,
         location,
         value,
         message,
         ParserIdentifier));
Example #5
0
        public static CssErrorFlags ToCssErrorFlags(this WarningLocation location)
        {
            switch (location)
            {
            case WarningLocation.Warnings:
                return(CssErrorFlags.UnderlinePurple | CssErrorFlags.TaskListWarning);

            default:
                return(CssErrorFlags.UnderlinePurple | CssErrorFlags.TaskListMessage);
            }
        }
Example #6
0
 internal ValidationReport AddWarning(WarningID id, WarningLocation location, string value, string messageFormat, params string[] messageArgs)
 {
     AddWarning(
         new Warning(
             id,
             location,
             value,
             string.Format(messageFormat, messageArgs),
             nameof(ValidationContext)));
     return(this);
 }
 private static Range ToRange(WarningLocation location)
 {
     if (!location.RefersToEntireFile)
     {
         return(new Range(
                    new Position(location.StartLine, location.StartLineColumn),
                    new Position(location.EndLine, location.EndLineColumn)));
     }
     else
     {
         return(new Range(new Position(0, 0), new Position(0, 0)));
     }
 }