This repository was archived by the owner on Dec 15, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +31
-8
lines changed Expand file tree Collapse file tree 5 files changed +31
-8
lines changed Original file line number Diff line number Diff line change 11const spellchecker = require ( 'spellchecker' ) ;
22const pathspec = require ( 'atom-pathspec' ) ;
33const env = require ( './checker-env' ) ;
4- const debug = require ( 'debug' ) ;
54
65// The locale checker is a checker that takes a locale string (`en-US`) and
76// optionally a path and then checks it.
@@ -22,7 +21,12 @@ class LocaleChecker {
2221 this . enabled = true ;
2322 this . hasSystemChecker = hasSystemChecker ;
2423 this . inferredLocale = inferredLocale ;
25- this . log = debug ( 'spell-check:locale-checker' ) . extend ( locale ) ;
24+ if ( atom . config . get ( 'spell-check.enableDebug' ) ) {
25+ debug = require ( 'debug' ) ;
26+ this . log = debug ( 'spell-check:locale-checker' ) . extend ( locale ) ;
27+ } else {
28+ this . log = ( str ) => { } ;
29+ }
2630 this . log (
2731 'enabled' ,
2832 this . isEnabled ( ) ,
Original file line number Diff line number Diff line change 11const { CompositeDisposable } = require ( 'atom' ) ;
2- const debug = require ( 'debug' ) ;
32
43let SpellCheckView = null ;
54let spellCheckViews = { } ;
65
76const LARGE_FILE_SIZE = 2 * 1024 * 1024 ;
87
8+ let log = ( str ) => { } ;
9+
910module . exports = {
1011 activate ( ) {
11- const log = debug ( 'spell-check' ) ;
12+ if ( atom . config . get ( 'spell-check.enableDebug' ) ) {
13+ debug = require ( 'debug' ) ;
14+ log = debug ( 'spell-check' ) ;
15+ }
16+
1217 log ( 'initializing' ) ;
1318
1419 this . subs = new CompositeDisposable ( ) ;
Original file line number Diff line number Diff line change 1- const debug = require ( 'debug' ) ;
21const env = require ( './checker-env' ) ;
32
43class SpellCheckerManager {
@@ -424,7 +423,12 @@ class SpellCheckerManager {
424423
425424 init ( ) {
426425 // Set up logging.
427- this . log = debug ( 'spell-check:spell-check-manager' ) ;
426+ if ( atom . config . get ( 'spell-check.enableDebug' ) ) {
427+ debug = require ( 'debug' ) ;
428+ this . log = debug ( 'spell-check:spell-check-manager' ) ;
429+ } else {
430+ this . log = ( str ) => { } ;
431+ }
428432
429433 // Set up the system checker.
430434 const hasSystemChecker = this . useSystem && env . isSystemSupported ( ) ;
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ let instance;
22const spellchecker = require ( 'spellchecker' ) ;
33const pathspec = require ( 'atom-pathspec' ) ;
44const env = require ( './checker-env' ) ;
5- const debug = require ( 'debug' ) ;
65
76// Initialize the global spell checker which can take some time. We also force
87// the use of the system or operating system library instead of Hunspell.
@@ -24,7 +23,12 @@ if (env.isSystemSupported()) {
2423// due to some memory bug.
2524class SystemChecker {
2625 constructor ( ) {
27- this . log = debug ( 'spell-check:system-checker' ) ;
26+ if ( atom . config . get ( 'spell-check.enableDebug' ) ) {
27+ debug = require ( 'debug' ) ;
28+ this . log = debug ( 'spell-check:system-checker' ) ;
29+ } else {
30+ this . log = ( str ) => { } ;
31+ }
2832 this . log ( 'enabled' , this . isEnabled ( ) , this . getStatus ( ) ) ;
2933 }
3034
Original file line number Diff line number Diff line change 110110 "description" : " Display notices only on the console"
111111 }
112112 ]
113+ },
114+ "enableDebug" : {
115+ "type" : " boolean" ,
116+ "default" : false ,
117+ "title" : " Enable debug information for spell check" ,
118+ "order" : 10
113119 }
114120 },
115121 "consumedServices" : {
You can’t perform that action at this time.
0 commit comments