( parser: Parser, file: string, filename: string, )
| 108 | } |
| 109 | |
| 110 | function nodeSurroundedInLazyBlocks( |
| 111 | parser: Parser, |
| 112 | |
| 113 | file: string, |
| 114 | filename: string, |
| 115 | ): { newTree: Parser.Tree; newFile: string } | undefined { |
| 116 | const ext = path.extname(filename).slice(1); |
| 117 | const language = LANGUAGES[ext]; |
| 118 | if (language) { |
| 119 | const newFile = `${language.singleLineComment} ... existing code ...\n\n${file}\n\n${language.singleLineComment} ... existing code...`; |
| 120 | const newTree = parser.parse(newFile); |
| 121 | |
| 122 | return { newTree, newFile }; |
| 123 | } |
| 124 | |
| 125 | return undefined; |
| 126 | } |
| 127 | |
| 128 | // TODO: If we don't have high confidence, return undefined to fall back to slower methods |
| 129 | export async function deterministicApplyLazyEdit({ |
no outgoing calls
no test coverage detected