@likec4/language-server 1.12.0 → 1.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/browser.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  const lsp = require('langium/lsp');
4
4
  const browser = require('vscode-languageserver/browser');
5
- const module$1 = require('./shared/language-server.BzrAcTYK.cjs');
5
+ const module$1 = require('./shared/language-server.BH0brgLf.cjs');
6
6
 
7
7
  function startLanguageServer() {
8
8
  const messageReader = new browser.BrowserMessageReader(self);
package/dist/browser.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { startLanguageServer as startLanguageServer$1 } from 'langium/lsp';
2
2
  import { BrowserMessageReader, BrowserMessageWriter, createConnection } from 'vscode-languageserver/browser';
3
- import { c as createLanguageServices } from './shared/language-server.BbMFBkE-.mjs';
4
- export { L as LikeC4Module, a as createCustomLanguageServices, s as setLogLevel } from './shared/language-server.BbMFBkE-.mjs';
3
+ import { c as createLanguageServices } from './shared/language-server.BYjS7OIz.mjs';
4
+ export { L as LikeC4Module, a as createCustomLanguageServices, s as setLogLevel } from './shared/language-server.BYjS7OIz.mjs';
5
5
 
6
6
  function startLanguageServer() {
7
7
  const messageReader = new BrowserMessageReader(self);
package/dist/index.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
  const lsp = require('langium/lsp');
4
4
  const node$1 = require('langium/node');
5
5
  const node = require('vscode-languageserver/node');
6
- const module$1 = require('./shared/language-server.BzrAcTYK.cjs');
6
+ const module$1 = require('./shared/language-server.BH0brgLf.cjs');
7
7
 
8
8
  function startLanguageServer() {
9
9
  const connection = node.createConnection(node.ProposedFeatures.all);
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { startLanguageServer as startLanguageServer$1 } from 'langium/lsp';
2
2
  import { NodeFileSystem } from 'langium/node';
3
3
  import { createConnection, ProposedFeatures } from 'vscode-languageserver/node';
4
- import { c as createLanguageServices } from './shared/language-server.BbMFBkE-.mjs';
5
- export { L as LikeC4Module, a as createCustomLanguageServices, l as lspLogger, s as setLogLevel } from './shared/language-server.BbMFBkE-.mjs';
4
+ import { c as createLanguageServices } from './shared/language-server.BYjS7OIz.mjs';
5
+ export { L as LikeC4Module, a as createCustomLanguageServices, l as lspLogger, s as setLogLevel } from './shared/language-server.BYjS7OIz.mjs';
6
6
 
7
7
  function startLanguageServer() {
8
8
  const connection = createConnection(ProposedFeatures.all);
@@ -3313,12 +3313,12 @@ function unpack({
3313
3313
  }))
3314
3314
  };
3315
3315
  }
3316
+ const MAX_LINE_LENGTH = 500;
3316
3317
  function serializeToComment(layout) {
3317
3318
  const bytes = msgpack.encode(pack(layout));
3318
3319
  const base64 = utilBase64.toBase64(bytes);
3319
3320
  const lines = [];
3320
3321
  let offset = 0;
3321
- const MAX_LINE_LENGTH = 200;
3322
3322
  while (offset < base64.length) {
3323
3323
  lines.push(" * " + base64.slice(offset, Math.min(offset + MAX_LINE_LENGTH, base64.length)));
3324
3324
  offset += MAX_LINE_LENGTH;
@@ -4364,19 +4364,22 @@ function changeViewLayout(_services, {
4364
4364
  core.invariant(viewAst.body, `View ${view.id} has no body`);
4365
4365
  const viewCstNode = viewAst.$cstNode;
4366
4366
  core.invariant(viewCstNode, "viewCstNode");
4367
- const newlayout = toAstViewLayoutDirection(layout);
4367
+ const newdirection = toAstViewLayoutDirection(layout.direction);
4368
4368
  const existingRule = viewAst.body.rules.findLast(isViewRuleAutoLayout);
4369
- if (existingRule && existingRule.$cstNode) {
4370
- const directionCstNode = findNodeForProperty(existingRule.$cstNode, "direction");
4371
- if (directionCstNode) {
4372
- return vscodeLanguageserverTypes.TextEdit.replace(directionCstNode.range, newlayout);
4369
+ let newRule = `autoLayout ${newdirection}`;
4370
+ if (remeda.isDefined(layout.rankSep)) {
4371
+ newRule += ` ${layout.rankSep}`;
4372
+ if (remeda.isDefined(layout.nodeSep)) {
4373
+ newRule += ` ${layout.nodeSep}`;
4373
4374
  }
4374
- return vscodeLanguageserverTypes.TextEdit.replace(existingRule.$cstNode.range, `autoLayout ${newlayout}`);
4375
+ }
4376
+ if (existingRule && existingRule.$cstNode) {
4377
+ return vscodeLanguageserverTypes.TextEdit.replace(existingRule.$cstNode.range, newRule);
4375
4378
  }
4376
4379
  const insertPos = findNodeForKeyword(viewAst.body.$cstNode, "}")?.range.start;
4377
4380
  core.invariant(insertPos, "Closing brace not found");
4378
- const insert = ` autoLayout ${newlayout}
4379
- ` + " ".repeat(insertPos.character);
4381
+ const insert = ` ${newRule}
4382
+ `;
4380
4383
  return vscodeLanguageserverTypes.TextEdit.insert(insertPos, insert);
4381
4384
  }
4382
4385
 
@@ -5569,7 +5572,8 @@ class LikeC4Formatter extends lsp.AbstractFormatter {
5569
5572
  formatLeafProperty(node) {
5570
5573
  if (isElementStringProperty(node) || isRelationStringProperty(node) || isViewStringProperty(node) || isNotationProperty(node) || isSpecificationElementStringProperty(node) || isSpecificationRelationshipStringProperty(node) || isColorProperty(node) || isLineProperty(node) || isArrowProperty(node) || isIconProperty(node) || isShapeProperty(node) || isBorderProperty(node) || isOpacityProperty(node)) {
5571
5574
  const formatter = this.getNodeFormatter(node);
5572
- formatter.keywords(
5575
+ const colon = formatter.keyword(":");
5576
+ const propertyName = formatter.keywords(
5573
5577
  "title",
5574
5578
  "description",
5575
5579
  "technology",
@@ -5582,8 +5586,12 @@ class LikeC4Formatter extends lsp.AbstractFormatter {
5582
5586
  "shape",
5583
5587
  "border",
5584
5588
  "opacity"
5585
- ).append(FormattingOptions.oneSpace);
5586
- formatter.keyword(":").prepend(FormattingOptions.noSpace).append(FormattingOptions.oneSpace);
5589
+ );
5590
+ if (colon.nodes.length === 0) {
5591
+ propertyName.append(FormattingOptions.oneSpace);
5592
+ } else {
5593
+ colon.prepend(FormattingOptions.noSpace).append(FormattingOptions.oneSpace);
5594
+ }
5587
5595
  formatter.keyword(";").prepend(FormattingOptions.noSpace).append(FormattingOptions.newLine);
5588
5596
  }
5589
5597
  }
@@ -3305,12 +3305,12 @@ function unpack({
3305
3305
  }))
3306
3306
  };
3307
3307
  }
3308
+ const MAX_LINE_LENGTH = 500;
3308
3309
  function serializeToComment(layout) {
3309
3310
  const bytes = encode(pack(layout));
3310
3311
  const base64 = toBase64(bytes);
3311
3312
  const lines = [];
3312
3313
  let offset = 0;
3313
- const MAX_LINE_LENGTH = 200;
3314
3314
  while (offset < base64.length) {
3315
3315
  lines.push(" * " + base64.slice(offset, Math.min(offset + MAX_LINE_LENGTH, base64.length)));
3316
3316
  offset += MAX_LINE_LENGTH;
@@ -4356,19 +4356,22 @@ function changeViewLayout(_services, {
4356
4356
  invariant(viewAst.body, `View ${view.id} has no body`);
4357
4357
  const viewCstNode = viewAst.$cstNode;
4358
4358
  invariant(viewCstNode, "viewCstNode");
4359
- const newlayout = toAstViewLayoutDirection(layout);
4359
+ const newdirection = toAstViewLayoutDirection(layout.direction);
4360
4360
  const existingRule = viewAst.body.rules.findLast(isViewRuleAutoLayout);
4361
- if (existingRule && existingRule.$cstNode) {
4362
- const directionCstNode = findNodeForProperty(existingRule.$cstNode, "direction");
4363
- if (directionCstNode) {
4364
- return TextEdit.replace(directionCstNode.range, newlayout);
4361
+ let newRule = `autoLayout ${newdirection}`;
4362
+ if (isDefined(layout.rankSep)) {
4363
+ newRule += ` ${layout.rankSep}`;
4364
+ if (isDefined(layout.nodeSep)) {
4365
+ newRule += ` ${layout.nodeSep}`;
4365
4366
  }
4366
- return TextEdit.replace(existingRule.$cstNode.range, `autoLayout ${newlayout}`);
4367
+ }
4368
+ if (existingRule && existingRule.$cstNode) {
4369
+ return TextEdit.replace(existingRule.$cstNode.range, newRule);
4367
4370
  }
4368
4371
  const insertPos = findNodeForKeyword(viewAst.body.$cstNode, "}")?.range.start;
4369
4372
  invariant(insertPos, "Closing brace not found");
4370
- const insert = ` autoLayout ${newlayout}
4371
- ` + " ".repeat(insertPos.character);
4373
+ const insert = ` ${newRule}
4374
+ `;
4372
4375
  return TextEdit.insert(insertPos, insert);
4373
4376
  }
4374
4377
 
@@ -5561,7 +5564,8 @@ class LikeC4Formatter extends AbstractFormatter {
5561
5564
  formatLeafProperty(node) {
5562
5565
  if (isElementStringProperty(node) || isRelationStringProperty(node) || isViewStringProperty(node) || isNotationProperty(node) || isSpecificationElementStringProperty(node) || isSpecificationRelationshipStringProperty(node) || isColorProperty(node) || isLineProperty(node) || isArrowProperty(node) || isIconProperty(node) || isShapeProperty(node) || isBorderProperty(node) || isOpacityProperty(node)) {
5563
5566
  const formatter = this.getNodeFormatter(node);
5564
- formatter.keywords(
5567
+ const colon = formatter.keyword(":");
5568
+ const propertyName = formatter.keywords(
5565
5569
  "title",
5566
5570
  "description",
5567
5571
  "technology",
@@ -5574,8 +5578,12 @@ class LikeC4Formatter extends AbstractFormatter {
5574
5578
  "shape",
5575
5579
  "border",
5576
5580
  "opacity"
5577
- ).append(FormattingOptions.oneSpace);
5578
- formatter.keyword(":").prepend(FormattingOptions.noSpace).append(FormattingOptions.oneSpace);
5581
+ );
5582
+ if (colon.nodes.length === 0) {
5583
+ propertyName.append(FormattingOptions.oneSpace);
5584
+ } else {
5585
+ colon.prepend(FormattingOptions.noSpace).append(FormattingOptions.oneSpace);
5586
+ }
5579
5587
  formatter.keyword(";").prepend(FormattingOptions.noSpace).append(FormattingOptions.newLine);
5580
5588
  }
5581
5589
  }
@@ -955,7 +955,7 @@ interface ParsedLikeC4LangiumDocument extends Omit<LangiumDocument<LikeC4Grammar
955
955
  }
956
956
  type Guard<N extends AstNode> = (n: AstNode) => n is N;
957
957
  type Guarded<G> = G extends Guard<infer N> ? N : never;
958
- declare const isValidatableAstNode: (n: AstNode) => n is Guarded<typeof isRelation | typeof isExtendElement | typeof isElement | typeof isLikeC4View | typeof isExtendElementBody | typeof isElementViewBody | typeof isSpecificationElementKind | typeof isSpecificationTag | typeof isSpecificationRelationshipKind | typeof isSpecificationColor | typeof isDynamicViewPredicateIterator | typeof isElementPredicateWith | typeof isRelationPredicateWith | typeof isElementExpression | typeof isRelationExpression | typeof isDynamicViewParallelSteps | typeof isDynamicViewStep | typeof isViewProperty | typeof isStyleProperty | typeof isTags | typeof isViewRule | typeof isDynamicViewRule | typeof isDynamicViewBody | typeof isRelationProperty | typeof isRelationBody | typeof isElementProperty | typeof isElementBody | typeof isSpecificationRule | typeof isModelViews | typeof isModel>;
958
+ declare const isValidatableAstNode: (n: AstNode) => n is Guarded<typeof isRelation | typeof isLikeC4View | typeof isExtendElement | typeof isElement | typeof isDynamicViewPredicateIterator | typeof isElementPredicateWith | typeof isRelationPredicateWith | typeof isElementExpression | typeof isRelationExpression | typeof isDynamicViewParallelSteps | typeof isDynamicViewStep | typeof isViewProperty | typeof isStyleProperty | typeof isTags | typeof isViewRule | typeof isDynamicViewRule | typeof isElementViewBody | typeof isDynamicViewBody | typeof isRelationProperty | typeof isRelationBody | typeof isElementProperty | typeof isElementBody | typeof isExtendElementBody | typeof isSpecificationElementKind | typeof isSpecificationRelationshipKind | typeof isSpecificationTag | typeof isSpecificationColor | typeof isSpecificationRule | typeof isModelViews | typeof isModel>;
959
959
  type ValidatableAstNode = Guarded<typeof isValidatableAstNode>;
960
960
  declare function checksFromDiagnostics(doc: LikeC4LangiumDocument): {
961
961
  isValid: (n: ValidatableAstNode) => boolean;
@@ -955,7 +955,7 @@ interface ParsedLikeC4LangiumDocument extends Omit<LangiumDocument<LikeC4Grammar
955
955
  }
956
956
  type Guard<N extends AstNode> = (n: AstNode) => n is N;
957
957
  type Guarded<G> = G extends Guard<infer N> ? N : never;
958
- declare const isValidatableAstNode: (n: AstNode) => n is Guarded<typeof isRelation | typeof isExtendElement | typeof isElement | typeof isLikeC4View | typeof isExtendElementBody | typeof isElementViewBody | typeof isSpecificationElementKind | typeof isSpecificationTag | typeof isSpecificationRelationshipKind | typeof isSpecificationColor | typeof isDynamicViewPredicateIterator | typeof isElementPredicateWith | typeof isRelationPredicateWith | typeof isElementExpression | typeof isRelationExpression | typeof isDynamicViewParallelSteps | typeof isDynamicViewStep | typeof isViewProperty | typeof isStyleProperty | typeof isTags | typeof isViewRule | typeof isDynamicViewRule | typeof isDynamicViewBody | typeof isRelationProperty | typeof isRelationBody | typeof isElementProperty | typeof isElementBody | typeof isSpecificationRule | typeof isModelViews | typeof isModel>;
958
+ declare const isValidatableAstNode: (n: AstNode) => n is Guarded<typeof isRelation | typeof isLikeC4View | typeof isExtendElement | typeof isElement | typeof isDynamicViewPredicateIterator | typeof isElementPredicateWith | typeof isRelationPredicateWith | typeof isElementExpression | typeof isRelationExpression | typeof isDynamicViewParallelSteps | typeof isDynamicViewStep | typeof isViewProperty | typeof isStyleProperty | typeof isTags | typeof isViewRule | typeof isDynamicViewRule | typeof isElementViewBody | typeof isDynamicViewBody | typeof isRelationProperty | typeof isRelationBody | typeof isElementProperty | typeof isElementBody | typeof isExtendElementBody | typeof isSpecificationElementKind | typeof isSpecificationRelationshipKind | typeof isSpecificationTag | typeof isSpecificationColor | typeof isSpecificationRule | typeof isModelViews | typeof isModel>;
959
959
  type ValidatableAstNode = Guarded<typeof isValidatableAstNode>;
960
960
  declare function checksFromDiagnostics(doc: LikeC4LangiumDocument): {
961
961
  isValid: (n: ValidatableAstNode) => boolean;
@@ -955,7 +955,7 @@ interface ParsedLikeC4LangiumDocument extends Omit<LangiumDocument<LikeC4Grammar
955
955
  }
956
956
  type Guard<N extends AstNode> = (n: AstNode) => n is N;
957
957
  type Guarded<G> = G extends Guard<infer N> ? N : never;
958
- declare const isValidatableAstNode: (n: AstNode) => n is Guarded<typeof isRelation | typeof isExtendElement | typeof isElement | typeof isLikeC4View | typeof isExtendElementBody | typeof isElementViewBody | typeof isSpecificationElementKind | typeof isSpecificationTag | typeof isSpecificationRelationshipKind | typeof isSpecificationColor | typeof isDynamicViewPredicateIterator | typeof isElementPredicateWith | typeof isRelationPredicateWith | typeof isElementExpression | typeof isRelationExpression | typeof isDynamicViewParallelSteps | typeof isDynamicViewStep | typeof isViewProperty | typeof isStyleProperty | typeof isTags | typeof isViewRule | typeof isDynamicViewRule | typeof isDynamicViewBody | typeof isRelationProperty | typeof isRelationBody | typeof isElementProperty | typeof isElementBody | typeof isSpecificationRule | typeof isModelViews | typeof isModel>;
958
+ declare const isValidatableAstNode: (n: AstNode) => n is Guarded<typeof isRelation | typeof isLikeC4View | typeof isExtendElement | typeof isElement | typeof isDynamicViewPredicateIterator | typeof isElementPredicateWith | typeof isRelationPredicateWith | typeof isElementExpression | typeof isRelationExpression | typeof isDynamicViewParallelSteps | typeof isDynamicViewStep | typeof isViewProperty | typeof isStyleProperty | typeof isTags | typeof isViewRule | typeof isDynamicViewRule | typeof isElementViewBody | typeof isDynamicViewBody | typeof isRelationProperty | typeof isRelationBody | typeof isElementProperty | typeof isElementBody | typeof isExtendElementBody | typeof isSpecificationElementKind | typeof isSpecificationRelationshipKind | typeof isSpecificationTag | typeof isSpecificationColor | typeof isSpecificationRule | typeof isModelViews | typeof isModel>;
959
959
  type ValidatableAstNode = Guarded<typeof isValidatableAstNode>;
960
960
  declare function checksFromDiagnostics(doc: LikeC4LangiumDocument): {
961
961
  isValid: (n: ValidatableAstNode) => boolean;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@likec4/language-server",
3
3
  "description": "LikeC4 Language Server",
4
- "version": "1.12.0",
4
+ "version": "1.12.2",
5
5
  "license": "MIT",
6
6
  "bugs": "https://github.com/likec4/likec4/issues",
7
7
  "homepage": "https://likec4.dev",
@@ -112,8 +112,8 @@
112
112
  },
113
113
  "dependencies": {
114
114
  "@dagrejs/graphlib": "^2.2.4",
115
- "@likec4/core": "1.12.0",
116
- "@likec4/log": "1.12.0",
115
+ "@likec4/core": "1.12.2",
116
+ "@likec4/log": "1.12.2",
117
117
  "@msgpack/msgpack": "^3.0.0-beta2",
118
118
  "@smithy/util-base64": "^3.0.0",
119
119
  "fast-equals": "^5.0.1",
@@ -133,8 +133,8 @@
133
133
  "vscode-uri": "3.0.8"
134
134
  },
135
135
  "devDependencies": {
136
- "@likec4/icons": "1.12.0",
137
- "@likec4/tsconfig": "1.12.0",
136
+ "@likec4/icons": "1.12.2",
137
+ "@likec4/tsconfig": "1.12.2",
138
138
  "@types/node": "^20.16.5",
139
139
  "@types/object-hash": "^3.0.6",
140
140
  "@types/string-hash": "^1.1.3",
@@ -143,9 +143,9 @@
143
143
  "langium-cli": "3.2.0",
144
144
  "npm-run-all2": "^6.2.2",
145
145
  "tsx": "~4.9.3",
146
- "turbo": "^2.1.2",
146
+ "turbo": "^2.1.3",
147
147
  "typescript": "^5.6.2",
148
- "unbuild": "^3.0.0-rc.8",
148
+ "unbuild": "^3.0.0-rc.11",
149
149
  "vitest": "^2.1.2"
150
150
  },
151
151
  "packageManager": "yarn@4.5.0"
@@ -179,7 +179,8 @@ export class LikeC4Formatter extends AbstractFormatter {
179
179
  || ast.isOpacityProperty(node)
180
180
  ) {
181
181
  const formatter = this.getNodeFormatter(node)
182
- formatter.keywords(
182
+ const colon = formatter.keyword(':')
183
+ const propertyName = formatter.keywords(
183
184
  'title',
184
185
  'description',
185
186
  'technology',
@@ -193,11 +194,15 @@ export class LikeC4Formatter extends AbstractFormatter {
193
194
  'border',
194
195
  'opacity'
195
196
  )
196
- .append(FormattingOptions.oneSpace)
197
197
 
198
- formatter.keyword(':')
199
- .prepend(FormattingOptions.noSpace)
200
- .append(FormattingOptions.oneSpace)
198
+ if (colon.nodes.length === 0) {
199
+ propertyName
200
+ .append(FormattingOptions.oneSpace)
201
+ } else {
202
+ colon
203
+ .prepend(FormattingOptions.noSpace)
204
+ .append(FormattingOptions.oneSpace)
205
+ }
201
206
 
202
207
  formatter.keyword(';')
203
208
  .prepend(FormattingOptions.noSpace)
@@ -1,5 +1,6 @@
1
- import { type AutoLayoutDirection, invariant } from '@likec4/core'
1
+ import { invariant, type ViewRuleAutoLayout } from '@likec4/core'
2
2
  import { GrammarUtils } from 'langium'
3
+ import { isDefined } from 'remeda'
3
4
  import { TextEdit } from 'vscode-languageserver-types'
4
5
  import { ast, type ParsedAstView, type ParsedLikeC4LangiumDocument, toAstViewLayoutDirection } from '../ast'
5
6
  import type { LikeC4Services } from '../module'
@@ -10,7 +11,7 @@ type ChangeViewLayoutArg = {
10
11
  view: ParsedAstView
11
12
  doc: ParsedLikeC4LangiumDocument
12
13
  viewAst: ast.LikeC4View
13
- layout: AutoLayoutDirection
14
+ layout: ViewRuleAutoLayout
14
15
  }
15
16
 
16
17
  export function changeViewLayout(_services: LikeC4Services, {
@@ -22,20 +23,25 @@ export function changeViewLayout(_services: LikeC4Services, {
22
23
  invariant(viewAst.body, `View ${view.id} has no body`)
23
24
  const viewCstNode = viewAst.$cstNode
24
25
  invariant(viewCstNode, 'viewCstNode')
25
- const newlayout = toAstViewLayoutDirection(layout)
26
+ const newdirection = toAstViewLayoutDirection(layout.direction)
26
27
  const existingRule = viewAst.body.rules.findLast(ast.isViewRuleAutoLayout) as ast.ViewRuleAutoLayout | undefined
27
28
 
28
- if (existingRule && existingRule.$cstNode) {
29
- const directionCstNode = findNodeForProperty(existingRule.$cstNode, 'direction')
30
- if (directionCstNode) {
31
- return TextEdit.replace(directionCstNode.range, newlayout)
29
+ let newRule = `autoLayout ${newdirection}`
30
+
31
+ if (isDefined(layout.rankSep)) {
32
+ newRule += ` ${layout.rankSep}`
33
+ if (isDefined(layout.nodeSep)) {
34
+ newRule += ` ${layout.nodeSep}`
32
35
  }
33
- return TextEdit.replace(existingRule.$cstNode.range, `autoLayout ${newlayout}`)
36
+ }
37
+
38
+ if (existingRule && existingRule.$cstNode) {
39
+ return TextEdit.replace(existingRule.$cstNode.range, newRule)
34
40
  }
35
41
 
36
42
  const insertPos = findNodeForKeyword(viewAst.body.$cstNode, '}')?.range.start
37
43
  invariant(insertPos, 'Closing brace not found')
38
- const insert = ` autoLayout ${newlayout}\n` + ' '.repeat(insertPos.character)
44
+ const insert = `\t${newRule}\n\t`
39
45
 
40
46
  return TextEdit.insert(insertPos, insert)
41
47
  }
@@ -53,12 +53,12 @@ function unpack({
53
53
  }
54
54
  }
55
55
 
56
+ const MAX_LINE_LENGTH = 500
56
57
  export function serializeToComment(layout: ViewManualLayout) {
57
58
  const bytes = encode(pack(layout))
58
59
  const base64 = toBase64(bytes)
59
60
  const lines = [] as string[]
60
61
  let offset = 0
61
- const MAX_LINE_LENGTH = 200
62
62
  while (offset < base64.length) {
63
63
  lines.push(' * ' + base64.slice(offset, Math.min(offset + MAX_LINE_LENGTH, base64.length)))
64
64
  offset += MAX_LINE_LENGTH
@@ -88,4 +88,4 @@ export function deserializeFromComment(comment: string): ViewManualLayout {
88
88
  .join('')
89
89
  const decodedb64 = fromBase64(b64)
90
90
  return unpack(decode(decodedb64) as any) as ViewManualLayout
91
- }
91
+ }