@@ -4,11 +4,9 @@ package snippets
4
4
import java .io .ByteArrayOutputStream
5
5
import java .io .PrintStream
6
6
7
- case class WrappedSnippet (snippet : String , lineOffset : Int , columnOffset : Int , lineBoilerplate : Int , columnBoilerplate : Int )
7
+ case class WrappedSnippet (snippet : String , outerLineOffset : Int , outerColumnOffset : Int , innerLineOffset : Int , innerColumnOffset : Int )
8
8
9
9
object WrappedSnippet :
10
- private val lineBoilerplate = 2
11
- private val columnBoilerplate = 2
12
10
13
11
def apply (str : String ): WrappedSnippet =
14
12
val baos = new ByteArrayOutputStream ()
@@ -17,15 +15,15 @@ object WrappedSnippet:
17
15
ps.println(" object Snippet {" )
18
16
str.split('\n ' ).foreach(ps.printlnWithIndent(2 , _))
19
17
ps.println(" }" )
20
- WrappedSnippet (baos.toString, 0 , 0 , lineBoilerplate, columnBoilerplate )
18
+ WrappedSnippet (baos.toString, 0 , 0 , 2 , 2 )
21
19
22
20
def apply (
23
21
str : String ,
24
22
packageName : Option [String ],
25
23
classInfos : Seq [SnippetCompilerData .ClassInfo ],
26
24
imports : List [String ],
27
- lineOffset : Int ,
28
- columnOffset : Int
25
+ outerLineOffset : Int ,
26
+ outerColumnOffset : Int
29
27
): WrappedSnippet =
30
28
val baos = new ByteArrayOutputStream ()
31
29
val ps = new PrintStream (baos)
@@ -42,8 +40,8 @@ object WrappedSnippet:
42
40
(0 to notEmptyClassInfos.size - 1 ).reverse.foreach( i => ps.printlnWithIndent(i * 2 , " }" ))
43
41
WrappedSnippet (
44
42
baos.toString,
45
- lineOffset ,
46
- columnOffset ,
43
+ outerLineOffset ,
44
+ outerColumnOffset ,
47
45
notEmptyClassInfos.size + notEmptyClassInfos.flatMap(_.names).size + packageName.size,
48
46
notEmptyClassInfos.size * 2 + 2
49
47
)
0 commit comments