@@ -18,7 +18,7 @@ const CurrentDoc = env => () => {
18
18
log = data => console.log( 'cos.compile:', JSON.stringify( data ) )
19
19
}
20
20
*/
21
- const { window, languages, log } = env
21
+ const { window, languages, log } = env
22
22
const editor = window . activeTextEditor
23
23
if ( ! editor ) return {
24
24
error : 'No active editor, open one at first'
@@ -39,22 +39,23 @@ const CurrentDoc = env => () => {
39
39
}
40
40
41
41
let file = ( fullname . match ( / [ ^ \\ \/ ] + $ / ) || [ ] ) [ 0 ] || '' //only filename without folders
42
- let code = doc . getText ( ) . replace ( / \/ \/ [ ^ \r \n ] * \r ? \n / g, '' ) // normalize EOL?
42
+ let code = doc . getText ( )
43
+ let ncode = code . replace ( / \/ \/ [ ^ \r \n ] * \r ? \n / g, '' ) // normalize EOL?
43
44
let name , ext , codename //server side name
44
45
45
46
const cdnm = ( { name, ext} ) => [ name , ext ] . join ( '.' )
46
47
47
48
if ( / \. c l s $ / i. test ( fullname ) ) { // is class?
48
49
49
- ( { name, ext } = clsRegexName ( code ) )
50
+ ( { name, ext } = clsRegexName ( ncode ) )
50
51
codename = cdnm ( { name, ext } )
51
52
if ( ! clsCheckNames ( { code : codename , file, log } ) ) return {
52
53
error : 'check names'
53
54
}
54
55
55
56
} else { // routines
56
57
57
- ( { name, ext } = rtnRegexName ( code ) )
58
+ ( { name, ext } = rtnRegexName ( ncode ) )
58
59
codename = cdnm ( { name, ext } )
59
60
if ( ! rtnCheckNames ( { code : codename , file, log } ) ) return {
60
61
error : 'check names'
@@ -66,7 +67,7 @@ const CurrentDoc = env => () => {
66
67
content : code . split ( / \r ? \n / g ) , // get code lines array
67
68
error : ''
68
69
}
69
-
70
+
70
71
}
71
72
72
- module . exports = { CurrentDoc }
73
+ module . exports = { CurrentDoc }
0 commit comments