Skip to content

Commit

Permalink
fix: ignore \n|\r
Browse files Browse the repository at this point in the history
  • Loading branch information
lvjiaxuan committed Oct 29, 2022
1 parent 6721f75 commit 191c85d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ export async function activate(context: ExtensionContext) {
context.subscriptions.push(...disposes, statusBarItem)

log('eslint-disabled initialized!')
statusBarItem.text = '$(check) eslint-disabled initialized!'
statusBarItem.show()
setTimeout(() => statusBarItem.hide(), 5000)
}

// this method is called when your extension is deactivated
Expand All @@ -58,7 +61,7 @@ const disposes = [
}

if (activeTextEditor.selections.length > 1) {
log('Sorry, we can not disable multi-lines for now. Support in later version.', true, 'OK')
log('Sorry, we can not disable multi-selections for now. Support it in later version.', true, 'OK')
return
}

Expand Down Expand Up @@ -99,8 +102,9 @@ const disposes = [

activeTextEditor.selections.forEach(selection => {


const text = getTextBylines(selection.start.line, selection.end.line)
if (!text) {
if (!text?.replace(/\n|\r/g, '')) {
log('No content to disable.', true, 'OK')
return
}
Expand Down

0 comments on commit 191c85d

Please # to comment.