Documentation ¶
Index ¶
- Variables
- type AdjustedRangeErr
- type InoLine
- type SketchMapper
- func (s *SketchMapper) ApplyTextChange(inoURI lsp.DocumentURI, inoChange lsp.TextDocumentContentChangeEvent) (dirty bool)
- func (s *SketchMapper) CppToInoLine(targetLine int) (string, int)
- func (s *SketchMapper) CppToInoLineOk(targetLine int) (string, int, bool)
- func (s *SketchMapper) CppToInoRange(cppRange lsp.Range) (string, lsp.Range)
- func (s *SketchMapper) CppToInoRangeOk(cppRange lsp.Range) (string, lsp.Range, error)
- func (s *SketchMapper) DebugLogAll()
- func (s *SketchMapper) InoToCppLSPRange(sourceURI lsp.DocumentURI, r lsp.Range) lsp.Range
- func (s *SketchMapper) InoToCppLSPRangeOk(sourceURI lsp.DocumentURI, r lsp.Range) (lsp.Range, bool)
- func (s *SketchMapper) InoToCppLine(sourceURI lsp.DocumentURI, line int) int
- func (s *SketchMapper) InoToCppLineOk(sourceURI lsp.DocumentURI, line int) (int, bool)
- func (s *SketchMapper) IsPreprocessedCppLine(cppLine int) bool
- type SourceRevision
Constants ¶
This section is empty.
Variables ¶
var NotIno = InoLine{"/not-ino", 0}
NotIno are lines that do not belongs to an .ino file
var NotInoURI, _ = lsp.NewDocumentURIFromURL("file:///not-ino")
NotInoURI is the DocumentURI that do not belongs to an .ino file
Functions ¶
This section is empty.
Types ¶
type AdjustedRangeErr ¶
type AdjustedRangeErr struct{}
AdjustedRangeErr is returned if the range overlaps with a non-ino section by just the last newline character.
func (AdjustedRangeErr) Error ¶
func (e AdjustedRangeErr) Error() string
type SketchMapper ¶
type SketchMapper struct { CppText *SourceRevision // contains filtered or unexported fields }
SketchMapper is a mapping between the .ino sketch and the preprocessed .cpp file
func CreateInoMapper ¶
func CreateInoMapper(targetFile []byte) *SketchMapper
CreateInoMapper create a InoMapper from the given target file
func (*SketchMapper) ApplyTextChange ¶
func (s *SketchMapper) ApplyTextChange(inoURI lsp.DocumentURI, inoChange lsp.TextDocumentContentChangeEvent) (dirty bool)
ApplyTextChange performs the text change and updates both .ino and .cpp files. It returns true if the change is "dirty", this happens when the change alters preprocessed lines and a new preprocessing may be probably required.
func (*SketchMapper) CppToInoLine ¶
func (s *SketchMapper) CppToInoLine(targetLine int) (string, int)
CppToInoLine converts a target (.cpp) line into a source.ino:line
func (*SketchMapper) CppToInoLineOk ¶
func (s *SketchMapper) CppToInoLineOk(targetLine int) (string, int, bool)
CppToInoLineOk converts a target (.cpp) line into a source (.ino) line and returns true if the conversion is successful
func (*SketchMapper) CppToInoRange ¶
CppToInoRange converts a target (.cpp) lsp.Range into a source.ino:lsp.Range. It will panic if the range spans across multiple ino files.
func (*SketchMapper) CppToInoRangeOk ¶
CppToInoRangeOk converts a target (.cpp) lsp.Range into a source.ino:lsp.Range. It returns an error if the range spans across multiple ino files. If the range ends on the beginning of a new line in another .ino file, the range is adjusted and AdjustedRangeErr is reported as err: the range may be still valid.
func (*SketchMapper) DebugLogAll ¶
func (s *SketchMapper) DebugLogAll()
DebugLogAll dumps the internal status of the mapper
func (*SketchMapper) InoToCppLSPRange ¶
func (s *SketchMapper) InoToCppLSPRange(sourceURI lsp.DocumentURI, r lsp.Range) lsp.Range
InoToCppLSPRange convert a lsp.Range reference to a .ino into a lsp.Range to .cpp
func (*SketchMapper) InoToCppLSPRangeOk ¶
func (s *SketchMapper) InoToCppLSPRangeOk(sourceURI lsp.DocumentURI, r lsp.Range) (lsp.Range, bool)
InoToCppLSPRangeOk convert a lsp.Range reference to a .ino into a lsp.Range to .cpp and returns true if the conversion is successful or false if the conversion is invalid.
func (*SketchMapper) InoToCppLine ¶
func (s *SketchMapper) InoToCppLine(sourceURI lsp.DocumentURI, line int) int
InoToCppLine converts a source (.ino) line into a target (.cpp) line
func (*SketchMapper) InoToCppLineOk ¶
func (s *SketchMapper) InoToCppLineOk(sourceURI lsp.DocumentURI, line int) (int, bool)
InoToCppLineOk converts a source (.ino) line into a target (.cpp) line
func (*SketchMapper) IsPreprocessedCppLine ¶
func (s *SketchMapper) IsPreprocessedCppLine(cppLine int) bool
IsPreprocessedCppLine returns true if the given .cpp line is part of the section added by the arduino preprocessor.
type SourceRevision ¶
SourceRevision is a source code tagged with a version number