microsoft / sarif-sdk

.NET code and supporting files for working with the 'Static Analysis Results Interchange Format' (SARIF, see https://github.com/oasis-tcs/sarif-spec)
Other
193 stars 91 forks source link

Configurable size of preview text for region in ConstructMultilineContextSnippet #2807

Open derigel23 opened 5 months ago

derigel23 commented 5 months ago

Currently, it's hardcoded to have one line before and one after for text preview of the region. I want to have control on size of this window.

        public Region ConstructMultilineContextSnippet(Region inputRegion, Uri uri, string fileText = null)
        {
        ....
           var region = new Region
            {
                StartLine = inputRegion.StartLine == 1 ? 1 : inputRegion.StartLine - 1,
                EndLine = inputRegion.EndLine == maxLineNumber ? maxLineNumber : inputRegion.EndLine + 1
            };

            // Generating multilineRegion with one line before and after.
            Region multilineContextSnippet = this.PopulateTextRegionProperties(region, uri, populateSnippet: true, fileText);
         ....