@bscotch/gcdata
Advanced tools
Comparing version 0.17.3 to 0.18.0
@@ -36,2 +36,4 @@ import { assert } from './assert.js'; | ||
]); | ||
/** Terms from the glossary for use in autocompletes */ | ||
const glossaryTerms = (packed.glossary?.relevantTerms() || []).map((t) => t.text); | ||
const result = { | ||
@@ -171,2 +173,13 @@ diagnostics: [], | ||
} | ||
// If this has a text section, provide glossary autocompletes | ||
if ('text' in parsedLine) { | ||
const start = parsedLine.text.start; | ||
const end = parsedLine.text.end; | ||
result.completions.push({ | ||
type: 'glossary', | ||
start, | ||
end, | ||
options: glossaryTerms, | ||
}); | ||
} | ||
// Track common problems so that we don't need to repeat logic | ||
@@ -173,0 +186,0 @@ /** The character where a mote should exist. */ |
@@ -41,2 +41,5 @@ import { z } from 'zod'; | ||
options: string[]; | ||
} | { | ||
type: 'glossary'; | ||
options: string[]; | ||
}; | ||
@@ -43,0 +46,0 @@ export interface ParsedClue { |
@@ -16,2 +16,4 @@ import { assert } from './assert.js'; | ||
}; | ||
/** Terms from the glossary for use in autocompletes */ | ||
const glossaryTerms = (packed.glossary?.relevantTerms() || []).map((t) => t.text); | ||
const checkSpelling = (item) => { | ||
@@ -94,2 +96,13 @@ if (!item || !options.checkSpelling) | ||
} | ||
// If this has a text section, provide glossary autocompletes | ||
if ('text' in parsedLine) { | ||
const start = parsedLine.text.start; | ||
const end = parsedLine.text.end; | ||
result.completions.push({ | ||
type: 'glossary', | ||
start, | ||
end, | ||
options: glossaryTerms, | ||
}); | ||
} | ||
// Work through each line type to add diagnostics and completions | ||
@@ -96,0 +109,0 @@ const labelLower = parsedLine.label?.value?.toLowerCase(); |
@@ -5,3 +5,3 @@ import type { Gcdata } from './GameChanger.js'; | ||
import type { ParsedBase, ParserResult } from './cl2.types.editor.js'; | ||
import type { Position } from './types.editor.js'; | ||
import type { Position, Range } from './types.editor.js'; | ||
import type { BschemaRoot, Mote } from './types.js'; | ||
@@ -11,2 +11,6 @@ export declare const storylineSchemaId = "cl2_storyline"; | ||
export type StorylineMote = Mote<StorylineData>; | ||
type CompletionsData = { | ||
type: 'glossary'; | ||
options: string[]; | ||
}; | ||
export interface StorylineUpdateResult extends ParserResult { | ||
@@ -16,2 +20,3 @@ parsed: ParsedBase & { | ||
}; | ||
completions: (Range & CompletionsData)[]; | ||
} | ||
@@ -27,2 +32,3 @@ export declare function listStorylines(gcData: Gcdata): StorylineMote[]; | ||
export declare function lineIsArrayItem(line: string): boolean; | ||
export {}; | ||
//# sourceMappingURL=cl2.storyline.types.d.ts.map |
{ | ||
"name": "@bscotch/gcdata", | ||
"version": "0.17.3", | ||
"version": "0.18.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "type": "module", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2649308
78921