package org.metaborg.core.tracing;

import javax.annotation.Nullable;

import org.metaborg.core.source.ISourceLocation;
import org.metaborg.core.source.ISourceRegion;

/**
 * Represents a resolution produced by reference resolution.
 */
public class Resolution {
    /**
     * Area in the source file to highlight as a hyperlink.
     */
    public final ISourceRegion highlight;

    /**
     * Resolution targets. Multiple targets indicate resolution to multiple valid locations.
     */
    public final Iterable<Resolution.Target> targets;


    public Resolution(ISourceRegion highlight, Iterable<Resolution.Target> targets) {
        this.highlight = highlight;
        this.targets = targets;
    }

    public static class Target {
        public final @Nullable String hyperlinkName;
        public final ISourceLocation location;

        public Target(ISourceLocation location) {
            this(null, location);
        }

        public Target(String hyperlinkName, ISourceLocation location) {
            this.hyperlinkName = hyperlinkName;
            this.location = location;
        }
    }
}

@@ -1052,46 +1052,468 @@
 Name
-;%0A            this.location = location
+ == null ? defaultHyperlinkName(location) : hyperlinkName;%0A            this.location = location;%0A        %7D%0A        %0A        private static String defaultHyperlinkName(ISourceLocation location) %7B%0A            String fileName = location.resource().getName().getBaseName();%0A            ISourceRegion region = location.region();%0A            int row = region.startRow();%0A            int col = region.startColumn();%0A            return fileName + %22:%22 + row + %22:%22 + col
 ;%0A  

Add default resolution label based on origin information