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) {
121
121
122
122
// Convert a SymbolLocation to LSP's Location.
123
123
// 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.
126
124
std::optional<Location> toLSPLocation (const SymbolLocation &Loc,
127
125
llvm::StringRef TUPath) {
128
126
if (!Loc)
129
127
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 ());
133
131
return std::nullopt;
134
132
}
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 ();
147
133
logIfOverflow (Loc);
148
- return LSPLoc;
134
+ return * LSPLoc;
149
135
}
150
136
151
137
SymbolLocation toIndexLocation (const Location &Loc, std::string &URIStorage) {
You can’t perform that action at this time.
0 commit comments