Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(formula): node maker handle blank #4347

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -714,5 +714,13 @@ describe('lexer nodeMaker test', () => {
const result = lexerTreeBuilder.moveFormulaRefOffset('=sum(A$1:B$3)', 1, 1, true);
expect(result).toStrictEqual('=sum(B$2:C$4)');
});

it('sheet name quote', () => {
let result = lexerTreeBuilder.moveFormulaRefOffset("= 'dv-test'!F26", 0, 1, true);
expect(result).toStrictEqual("= 'dv-test'!F27");

result = lexerTreeBuilder.moveFormulaRefOffset("=SUM( 'dv-test'!F26)", 0, 1, true);
expect(result).toStrictEqual("=SUM( 'dv-test'!F27)");
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -1446,6 +1446,13 @@ export class LexerTreeBuilder extends Disposable {
} else if (currentString === matchToken.SINGLE_QUOTATION && this.isDoubleQuotationClose()) {
if (this.isSingleQuotationClose()) {
this._openSingleQuotation();

// If the current segment is blank, reset the segment.
// Process the space before the double single quotes of sheet name.
// e.g. = 'dv-test'!C27
if (this._segmentCount() === 0) {
this._resetSegment();
}
} else {
const nextCurrentString = formulaStringArray[cur + 1];
if (nextCurrentString && nextCurrentString === matchToken.SINGLE_QUOTATION) {
Expand Down
Loading