Skip to content

Commit e39ff72

Browse files
committed
Fix comping regex to support Kotlin escapes
Fixes gh-26
1 parent d1fa17b commit e39ff72

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/code-chomping-extension.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const JAVA_LIKE = ['groovy', 'java', 'kotlin']
1212
const ChompDirRx = /\/\/ @chomp:(file|line)$/
1313
const ChompAndReplaceDirRx = /^(.+?)\/\*(?: @chomp:line (.+?) )?\*\/ ?\S/
1414
const FormatterDirRx = /\/\/ @formatter:(?:on|off)$/
15-
const PackageDeclRx = /^package (?:[a-z][a-z0-9]*(?:[.][a-z][a-z0-9]*)*)(;|)$/
15+
const PackageDeclRx = /^package (?:[a-z`][a-z0-9`]*(?:[.][a-z`][a-z0-9`]*)*)(;|)$/
1616
const SuppressAnnotRx = /@Suppress(?:Warnings)?\(.+?\)$/
1717

1818
function register (registry) {

test/code-chomping-extension-test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ describe('code-chomping-extension', () => {
127127
* Copyright 2000-present ACME Corp. Free the source!
128128
*/
129129
130-
package org.example
130+
package org.example.\`object\`
131131
132132
public class Example {}
133133
`

0 commit comments

Comments
 (0)