Skip to content

Commit 63e2721

Browse files
committed
Do not consider preprocessed section as part of the sketch.
Maybe this should be done on the sketchmapper side?
1 parent e436a82 commit 63e2721

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Diff for: handler/handler.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,13 @@ func (handler *InoHandler) cpp2inoDocumentURI(cppURI lsp.DocumentURI, cppRange l
10621062
if cppPath.EquivalentTo(handler.buildSketchCpp) {
10631063
inoPath, inoRange, err := handler.sketchMapper.CppToInoRangeOk(cppRange)
10641064
if err == nil {
1065-
log.Printf(" URI: converted %s to %s:%s", cppRange, inoPath, inoRange)
1065+
if handler.sketchMapper.IsPreprocessedCppLine(cppRange.Start.Line) {
1066+
inoPath = sourcemapper.NotIno.File
1067+
log.Printf(" URI: is in preprocessed section")
1068+
log.Printf(" converted %s to %s:%s", cppRange, inoPath, inoRange)
1069+
} else {
1070+
log.Printf(" URI: converted %s to %s:%s", cppRange, inoPath, inoRange)
1071+
}
10661072
} else if _, ok := err.(sourcemapper.AdjustedRangeErr); ok {
10671073
log.Printf(" URI: converted %s to %s:%s (END LINE ADJUSTED)", cppRange, inoPath, inoRange)
10681074
err = nil

0 commit comments

Comments
 (0)