Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 3 additions & 0 deletions Composer/packages/server/src/services/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ export class BotProjectService {
'turn.recognized.intent',
'turn.recognized.score',
'turn.recognized.text',
'turn.recognized.alteredText',
'turn.recognized.entities',
'turn.recognized.intents',
'turn.unrecognizedText',
'turn.recognizedEntities',
'turn.interrupted',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ export class LGServer {
if (diagnostics.length) {
return Promise.resolve(null);
}
const wordRange = getRangeAtPosition(document, params.position);
const wordRange = getRangeAtPosition(document, params.position, true);
let word = document.getText(wordRange);
const matchItem = allTemplates.find((u) => u.name === word);
if (matchItem) {
Expand Down Expand Up @@ -619,7 +619,7 @@ export class LGServer {
const document = this.documents.get(params.textDocument.uri);
if (!document) return [];
const position = params.position;
const range = getRangeAtPosition(document, position);
const range = getRangeAtPosition(document, position, true);
const wordAtCurRange = document.getText(range);
const endWithDot = wordAtCurRange.endsWith('.');
const memoryVariblesRootCompletionList: CompletionItem[] = [];
Expand Down Expand Up @@ -652,7 +652,7 @@ export class LGServer {
return Promise.resolve(null);
}
const position = params.position;
const range = getRangeAtPosition(document, position);
const range = getRangeAtPosition(document, position, true);
const wordAtCurRange = document.getText(range);
const endWithDot = wordAtCurRange.endsWith('.');
const includesDot = wordAtCurRange.includes('.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,17 @@ export interface LGDocument {

export type LGFileResolver = (id: string) => LgFile | undefined;

export function getRangeAtPosition(document: TextDocument, position: Position): Range | undefined {
export function getRangeAtPosition(
document: TextDocument,
position: Position,
includesDotAndAt?: boolean
): Range | undefined {
const text = document.getText();
const line = position.line;
const pos = position.character;
const lineText = text.split(/\r?\n/g)[line];
let match: RegExpMatchArray | null;
const wordDefinition = /[a-zA-Z0-9_]+/g;
const wordDefinition = includesDotAndAt ? /[a-zA-Z0-9_.@]+/g : /[a-zA-Z0-9_]+/g;
while ((match = wordDefinition.exec(lineText))) {
const matchIndex = match.index || 0;
if (matchIndex > pos) {
Expand Down