Skip to content

Commit e0487b4

Browse files
committed
Do not bail-out if incorrect ranges are requested via DocumentSymbol
1 parent 7fc6ab3 commit e0487b4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Diff for: ls/ls_clang_to_ide.go

+6-3
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ func (ls *INOLanguageServer) clang2IdeDocumentSymbols(logger jsonrpc.FunctionLog
209209
logger.Logf(" > convert %s %s", clangSymbol.Kind, clangSymbol.Range)
210210
ideURI, ideRange, isPreprocessed, err := ls.clang2IdeRangeAndDocumentURI(logger, clangURI, clangSymbol.Range)
211211
if err != nil {
212-
return nil, err
212+
logger.Logf(" filtering out invalid symbol range: %s", err)
213+
continue
213214
}
214215
if isPreprocessed {
215216
logger.Logf(" symbol is in the preprocessed section of the sketch.ino.cpp, skipping")
@@ -221,7 +222,8 @@ func (ls *INOLanguageServer) clang2IdeDocumentSymbols(logger jsonrpc.FunctionLog
221222
}
222223
ideSelectionURI, ideSelectionRange, isSelectionPreprocessed, err := ls.clang2IdeRangeAndDocumentURI(logger, clangURI, clangSymbol.SelectionRange)
223224
if err != nil {
224-
return nil, err
225+
logger.Logf(" filtering out invalid symbol selection-range: %s", err)
226+
continue
225227
}
226228
if ideSelectionURI != ideURI || isSelectionPreprocessed {
227229
logger.Logf(" ERROR: doc of symbol-selection-range does not match doc of symbol-range")
@@ -232,7 +234,8 @@ func (ls *INOLanguageServer) clang2IdeDocumentSymbols(logger jsonrpc.FunctionLog
232234

233235
ideChildren, err := ls.clang2IdeDocumentSymbols(logger, clangSymbol.Children, clangURI, origIdeURI)
234236
if err != nil {
235-
return nil, err
237+
logger.Logf(" filtering out invalid document-symbol: %s", err)
238+
continue
236239
}
237240

238241
ideSymbols = append(ideSymbols, lsp.DocumentSymbol{

0 commit comments

Comments
 (0)