void ISourceMap.Add(object item, SourceRange range)
        {
            if (!Path.IsPathRooted(range.Path))
            {
                throw new ArgumentOutOfRangeException(range.Path);
            }

            lock (gate)
            {
                sourceByItem[item] = range;
                dirty = true;
            }
        }
Beispiel #2
0
        bool ISourceMap.TryGetValue(object item, out SourceRange range)
        {
            lock (_gate)
            {
                if (item != null)
                {
                    return(_sourceByItem.TryGetValue(item, out range));
                }

                range = default;
                return(false);
            }
        }
 public static void Assign(Protocol.Range target, SourceRange source)
 {
     if (source != null)
     {
         target.Source    = new Protocol.Source(source.Path);
         target.Line      = source.StartPoint.LineIndex;
         target.EndLine   = source.EndPoint.LineIndex;
         target.Column    = source.StartPoint.CharIndex;
         target.EndColumn = source.EndPoint.CharIndex;
     }
     else
     {
         target.Source    = null;
         target.Line      = null;
         target.EndLine   = null;
         target.Column    = null;
         target.EndColumn = null;
     }
 }