File tree Expand file tree Collapse file tree 1 file changed +4
-18
lines changed Expand file tree Collapse file tree 1 file changed +4
-18
lines changed Original file line number Diff line number Diff line change @@ -121,31 +121,17 @@ void logIfOverflow(const SymbolLocation &Loc) {
121121
122122// Convert a SymbolLocation to LSP's Location.
123123// TUPath is used to resolve the path of URI.
124- // FIXME: figure out a good home for it, and share the implementation with
125- // FindSymbols.
126124std::optional<Location> toLSPLocation (const SymbolLocation &Loc,
127125 llvm::StringRef TUPath) {
128126 if (!Loc)
129127 return std::nullopt ;
130- auto Uri = URI::parse (Loc. FileURI );
131- if (!Uri ) {
132- elog (" Could not parse URI {0}: {1} " , Loc. FileURI , Uri .takeError ());
128+ auto LSPLoc = indexToLSPLocation (Loc, TUPath );
129+ if (!LSPLoc ) {
130+ elog (" {0}" , LSPLoc .takeError ());
133131 return std::nullopt ;
134132 }
135- auto U = URIForFile::fromURI (*Uri, TUPath);
136- if (!U) {
137- elog (" Could not resolve URI {0}: {1}" , Loc.FileURI , U.takeError ());
138- return std::nullopt ;
139- }
140-
141- Location LSPLoc;
142- LSPLoc.uri = std::move (*U);
143- LSPLoc.range .start .line = Loc.Start .line ();
144- LSPLoc.range .start .character = Loc.Start .column ();
145- LSPLoc.range .end .line = Loc.End .line ();
146- LSPLoc.range .end .character = Loc.End .column ();
147133 logIfOverflow (Loc);
148- return LSPLoc;
134+ return * LSPLoc;
149135}
150136
151137SymbolLocation toIndexLocation (const Location &Loc, std::string &URIStorage) {
You can’t perform that action at this time.
0 commit comments