public override void AppendLineDirective(T4CSharpCodeGenerationResult destination, IT4TreeNode node) { var sourceFile = node.FindLogicalPsiSourceFile(); int offset = T4UnsafeManualRangeTranslationUtil.GetDocumentStartOffset(node).Offset; int line = (int)sourceFile.Document.GetCoordsByOffset(offset).Line; destination.AppendLine($"#line {line + 1} \"{sourceFile.GetLocation()}\""); }
public static T4FailureRawData FromElement([NotNull] ITreeNode node, [NotNull] string message) { node.GetSolution().Locks.AssertReadAccessAllowed(); var file = FindSuitableSourceFile(node); var offset = T4UnsafeManualRangeTranslationUtil.GetDocumentStartOffset(node); var coords = offset.Document.GetCoordsByOffset(offset.Offset); return(new T4FailureRawData((int)coords.Line, (int)coords.Column, file, message)); }
public static T4FailureRawData FromElement([NotNull] ITreeNode node, [NotNull] string message) { var file = node.GetParentOfType <IT4FileLikeNode>().NotNull(); file.GetSolution().Locks.AssertReadAccessAllowed(); var projectFile = file.LogicalPsiSourceFile.ToProjectFile().NotNull(); var offset = T4UnsafeManualRangeTranslationUtil.GetDocumentStartOffset(node); var coords = offset.Document.GetCoordsByOffset(offset.Offset); return(new T4FailureRawData((int)coords.Line, (int)coords.Column, projectFile, message)); }
public override void AppendCompilationOffset(T4CSharpCodeGenerationResult destination, IT4TreeNode node) { int documentOffset = T4UnsafeManualRangeTranslationUtil.GetDocumentStartOffset(node).Offset; var lineOffset = node .FindLogicalPsiSourceFile() .Document .GetCoordsByOffset(documentOffset) .Column; for (var i = Int32 <DocColumn> .O; i < lineOffset; i++) { destination.Append(" "); } }