Skip to content

Commit

Permalink
fix(Queries): chyt spyt path autocomplete [YTFRONT-4368]
Browse files Browse the repository at this point in the history
  • Loading branch information
SimbiozizV committed Sep 24, 2024
1 parent 7347349 commit df3cff1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,12 @@ export const createProvideSuggestionsFunction =
});

const range = getRangeToInsertSuggestion(model, monacoCursorPosition);
let pathSuggestions: languages.CompletionItem[] = [];
if ('suggestEntity' in parseResult && parseResult.suggestEntity?.includes('table')) {
pathSuggestions = await getDirectoryContent({
model,
monacoCursorPosition,
engine,
range,
});
}
const pathSuggestions = await getDirectoryContent({
model,
monacoCursorPosition,
engine,
range,
});

const additionalSuggestion = additionalSuggestions
? additionalSuggestions(range, parseResult)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,10 @@ export const getPathFromMonacoModel = (
const useArray = model.getValue().match(/(USE|use)\s\w+/g);
const useClusterName = useArray ? useArray.pop()?.replace(/(USE|use)\s/, '') : null;

let path: RegExpMatchArray | null = null;
if (engine === QueryEngine.SPYT) {
path = editedPart.match(/\/\/(.*)[^`]/);
} else {
path = editedPart.match(/\/\/[^`]+/g);
}

const path = editedPart.match(/\/\/[^`]+/g);
let cluster = clusterName || useClusterName;

if (!cluster) {
// get cluster from select
if (!cluster || engine === QueryEngine.SPYT) {
const state = getWindowStore().getState();
cluster = state.queryTracker.query?.draft.settings?.cluster;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export const language: languages.IMonarchLanguage & Record<string, unknown> = {
{include: '@complexDataTypes'},
[/[;,.]/, TokenClassConsts.DELIMITER],
[/[(){}[\]]/, '@brackets'],
[/yt\.`(.*)`/, 'path'],
[/yt\.`(\/\/.*)`/g, {token: 'path'}],
[
/[\w@#$]+/,
{
Expand Down

0 comments on commit df3cff1

Please sign in to comment.