I'm not super familiar with golf at this point, but there's gotta be a way to configure error handling this. It can't always just freak out when there's no ;
at the end while you're in the middle of typing, your SCSS, right?
在这一点上,我对高尔夫不是很熟悉,但一定有一种方法来配置错误处理。它不能总是在没有的时候就吓坏了;当你打字到一半的时候,你的SCSS,对吗?
What am I missing? Researched this and can't seem to find an answer. And it's really annoying that this isn't just built into VS code seeing as Sass, SCSS, and Less are some of the most common plug-ins in any project in 2023. It shouldn't be this hard...
我遗漏了什么?对此进行了研究,但似乎找不到答案。这真的很令人恼火,因为这不只是内置到VS代码中,因为Sass、SCSS或更少是2023年任何项目中最常见的一些插件。不应该这么难的。
It just seems to be choking when it encounters half-done code. Rather than handling it.
当它遇到未完成的代码时,它似乎会窒息。而不是处理它。
Thanks.
谢谢。
Gulpfile directly from VS Code documentation site:
直接来自VS代码文档站点的Gulpfile:
// Sass configuration
var gulp = require('gulp');
var sass = require('gulp-sass')(require('sass'));
gulp.task('sass', function (cb) {
gulp
.src('*.scss')
.pipe(sass())
.pipe(
gulp.dest(function (f) {
return f.base;
})
);
cb();
});
gulp.task(
'default',
gulp.series('sass', function (cb) {
gulp.watch('*.scss', gulp.series('sass'));
cb();
})
);
Error:
错误:
node:events:491
throw er; // Unhandled 'error' event
^
<ref *1> PluginError: Expected expression.
╷
44 │ bottom: ;
│ ^
╵
styles.scss 44:11 root stylesheet
at Object.wrapException (/Users/studio/GeneralAssembly/projects/Baby Bumper/Baby Bumper Game/node_modules/sass/sass.dart.js:1252:43)
at SpanScanner.error$3$length$position (/Users/studio/GeneralAssembly/projects/Baby Bumper/Baby Bumper Game/node_modules/sass/sass.dart.js:76246:15)
at SpanScanner.error$1 (/Users/studio/GeneralAssembly/projects/Baby Bumper/Baby Bumper Game/node_modules/sass/sass.dart.js:76249:19)
at ScssParser0._stylesheet0$_singleExpression$0 (/Users/studio/GeneralAssembly/projects/Baby Bumper/Baby Bumper Game/node_modules/sass/sass.dart.js:108600:17)
at ScssParser0._stylesheet0$_expression$3$bracketList$singleEquals$until (/Users/studio/GeneralAssembly/projects/Baby Bumper/Baby Bumper Game/node_modules/sass/sass.dart.js:108275:40)
at ScssParser0._stylesheet0$_expression$0 (/Users/studio/GeneralAssembly/projects/Baby Bumper/Baby Bumper Game/node_modules/sass/sass.dart.js:108509:19)
at ScssParser0._stylesheet0$_declarationOrBuffer$0 (/Users/studio/GeneralAssembly/projects/Baby Bumper/Baby Bumper Game/node_modules/sass/sass.dart.js:107112:31)
at ScssParser0._stylesheet0$_declarationOrStyleRule$0 (/Users/studio/GeneralAssembly/projects/Baby Bumper/Baby Bumper Game/node_modules/sass/sass.dart.js:107049:35)
at ScssParser0._stylesheet0$_statement$1$root (/Users/studio/GeneralAssembly/projects/Baby Bumper/Baby Bumper Game/node_modules/sass/sass.dart.js:106941:162)
at ScssParser0._stylesheet0$_statement$0 (/Users/studio/GeneralAssembly/projects/Baby Bumper/Baby Bumper Game/node_modules/sass/sass.dart.js:106944:19)
Emitted 'error' event on Domain instance at:
at Transform.emit (node:domain:540:12)
at Transform.onerror (/Users/studio/GeneralAssembly/projects/Baby Bumper/Baby Bumper Game/node_modules/readable-stream/lib/_stream_readable.js:640:52)
at Transform.emit (node:events:513:28)
at Transform.emit (node:domain:489:12)
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
formatted: 'Error: Expected expression.\n' +
' ╷\n' +
'44 │ bottom: ;\n' +
' │ ^\n' +
' ╵\n' +
' styles.scss 44:11 root stylesheet',
line: 44,
column: 11,
file: '/Users/studio/GeneralAssembly/projects/Baby Bumper/Baby Bumper Game/styles.scss',
status: 1,
messageFormatted: '\x1B[4mstyles.scss\x1B[24m\n' +
'Error: Expected expression.\n' +
' ╷\n' +
'44 │ bottom: ;\n' +
' │ ^\n' +
' ╵\n' +
' styles.scss 44:11 root stylesheet',
messageOriginal: 'Expected expression.\n' +
' ╷\n' +
'44 │ bottom: ;\n' +
' │ ^\n' +
' ╵\n' +
' styles.scss 44:11 root stylesheet',
relativePath: 'styles.scss',
message: 'styles.scss\n' +
'Error: Expected expression.\n' +
' ╷\n' +
'44 │ bottom: ;\n' +
' │ ^\n' +
' ╵\n' +
' styles.scss 44:11 root stylesheet',
__safety: undefined,
_stack: undefined,
plugin: 'gulp-sass',
showProperties: true,
showStack: false,
domainEmitter: Transform {
_readableState: ReadableState {
objectMode: true,
highWaterMark: 16,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: [
Pumpify {
_readableState: ReadableState {
objectMode: true,
highWaterMark: 16,
buffer: [BufferList],
length: 0,
pipes: [WriteStream],
pipesCount: 1,
flowing: true,
ended: false,
endEmitted: false,
reading: true,
sync: false,
needReadable: true,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
destroyed: false,
defaultEncoding: 'utf8',
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null
},
readable: true,
_events: [Object: null prototype] {
end: [Array],
close: [Array],
prefinish: [Function (anonymous)],
newListener: [Function: removeSink],
removeListener: [Array],
unpipe: [Function: onunpipe],
error: [Function: onerror],
finish: [Function],
data: [Function: ondata]
},
_eventsCount: 9,
_maxListeners: undefined,
_writableState: WritableState {
objectMode: true,
highWaterMark: 16,
finalCalled: false,
needDrain: false,
ending: false,
ended: false,
finished: false,
destroyed: false,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: true,
bufferProcessing: false,
onwrite: [Function (anonymous)],
writecb: null,
writelen: 0,
bufferedRequest: null,
lastBufferedRequest: null,
pendingcb: 0,
prefinished: false,
errorEmitted: false,
bufferedRequestCount: 0,
corkedRequestsFree: [CorkedRequest]
},
writable: true,
allowHalfOpen: true,
_writable: DestroyableTransform {
_readableState: [ReadableState],
readable: true,
_events: [Object: null prototype],
_eventsCount: 7,
_maxListeners: undefined,
_writableState: [WritableState],
writable: true,
allowHalfOpen: true,
_transformState: [Object],
_destroyed: false,
_transform: [Function: normalize],
[Symbol(kCapture)]: false
},
_readable: DestroyableTransform {
_readableState: [ReadableState],
readable: true,
_events: [Object: null prototype],
_eventsCount: 8,
_maxListeners: undefined,
_writableState: [WritableState],
writable: true,
allowHalfOpen: true,
_transformState: [Object],
_destroyed: false,
_transform: [Function: writeFile],
[Symbol(kCapture)]: false
},
_readable2: DestroyableTransform {
_readableState: [ReadableState],
readable: true,
_events: [Object: null prototype],
_eventsCount: 8,
_maxListeners: undefined,
_writableState: [WritableState],
writable: true,
allowHalfOpen: true,
_transformState: [Object],
_destroyed: false,
_transform: [Function: writeFile],
[Symbol(kCapture)]: false
},
_autoDestroy: false,
_forwardDestroy: false,
_forwardEnd: true,
_corked: 0,
_ondrain: null,
_drained: true,
_forwarding: false,
_unwrite: [Function: clear],
_unread: [Function: clear],
_ended: false,
[Symbol(kCapture)]: false
}
],
flowing: true,
ended: false,
endEmitted: false,
reading: true,
constructed: true,
sync: false,
needReadable: true,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
errorEmitted: true,
emitClose: true,
autoDestroy: true,
destroyed: true,
errored: [Circular *1],
closed: true,
closeEmitted: false,
defaultEncoding: 'utf8',
awaitDrainWriters: null,
multiAwaitDrain: false,
readingMore: false,
dataEmitted: false,
decoder: null,
encoding: null,
[Symbol(kPaused)]: false
},
_events: [Object: null prototype] {
prefinish: [Function: prefinish],
end: [Function: bound onceWrapper] { listener: [Function: onend] },
data: [Function: ondata]
},
_eventsCount: 3,
_maxListeners: undefined,
_writableState: WritableState {
objectMode: true,
highWaterMark: 16,
finalCalled: false,
needDrain: false,
ending: true,
ended: true,
finished: false,
destroyed: true,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
afterWriteTickInfo: null,
buffered: [],
bufferedIndex: 0,
allBuffers: true,
allNoop: true,
pendingcb: 0,
constructed: true,
prefinished: false,
errorEmitted: true,
emitClose: true,
autoDestroy: true,
errored: [Circular *1],
closed: true,
closeEmitted: false,
[Symbol(kOnFinished)]: []
},
allowHalfOpen: true,
_transform: [Function (anonymous)],
[Symbol(kCapture)]: false,
[Symbol(kCallback)]: null
},
domainThrown: false
}
✘ studio@ians-mac-mini ~/GeneralAssembly/projects/Baby Bumper/Baby Bumper Game master ±✚
更多回答
我是一名优秀的程序员,十分优秀!