Exemplo n.º 1
0
        public bool TryGetFileByPath(FileSystemPath path, out IPsiSourceFile file)
        {
            file = null;
            if (mySourceFiles.TryGetValue(path, out var pair))
            {
                file = pair.First;
                return(true);
            }

            return(false);
        }
Exemplo n.º 2
0
        internal ILinkResponse ResolveLink(LinkRequest @struct, IRdCall <FString, bool> isBlueprintPathName)
        {
            // ReSharper disable once LocalFunctionCanBeMadeStatic
            string SqueezeBorders(string s, out int l, out int r)
            {
                l = 0;
                r = s.Length;
                if (s.EndsWith("."))
                {
                    --r;
                }

                if (PairSymbol.TryGetValue(s[r - 1], out var value))
                {
                    l = s.AsSpan(l, r - l - 1).LastIndexOf(value) + 1;
                    --r;
                }

                return(s.Substring(l, r - l));
            }

            var link     = @struct.Data.Data;
            var squeezed = SqueezeBorders(link, out var left, out var right);
            var range    = new StringRange(left, right);

            var fullPath = TryParseFullPath(squeezed, range);

            if (fullPath != null)
            {
                return(fullPath);
            }

            var fullName = TryParseFullName(squeezed, range, isBlueprintPathName);

            if (fullName != null)
            {
                return(fullName);
            }


            return(new LinkResponseUnresolved());
        }