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: editor warning #2446

Merged
merged 3 commits into from
Mar 31, 2020
Merged
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 @@ -48,7 +48,7 @@ export function isDiagnosticWithInRange(diagnostic: Diagnostic, range: CodeRange
}

export function filterTemplateDiagnostics(diagnostics: Diagnostic[], { range }: { range?: CodeRange }): Diagnostic[] {
if (!range) return diagnostics;
if (!range) return [];
const filteredDiags = diagnostics.filter(d => {
return d.range && isDiagnosticWithInRange(d, range);
});
Expand Down
4 changes: 2 additions & 2 deletions Composer/packages/lib/shared/src/resolverFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ export function importResolverGenerator(
*
* would resolve to common.en-us.lg || common.lg
*
* source = todosample || todosample.en-us || todosample.en-us.lg || todosample.lg
* source = todosample || todosample.en-us || todosample.en-us.lg || todosample.lg || .
* resourceId = common || common.lg || ../common/common.lg
*
*/
return (source: string, resourceId: string) => {
// eslint-disable-next-line security/detect-non-literal-regexp
const extReg = new RegExp(ext + '$');
const sourceId = getFileName(source).replace(extReg, '');
const locale = sourceId.split('.').length > 1 ? sourceId.split('.').pop() : defaultLocale;
const locale = /\w\.\w/.test(sourceId) ? sourceId.split('.').pop() : defaultLocale;
const targetId = getFileName(resourceId).replace(extReg, '');

const targetFile =
Expand Down
4 changes: 0 additions & 4 deletions Composer/packages/ui-plugins/lg/src/LgField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ const LgField: React.FC<FieldProps<string>> = props => {
name: lgName,
parameters: [],
body: getInitialTemplate(name, value),
range: {
startLineNumber: 0,
endLineNumber: 2,
},
};

const diagnostics = lgFile ? filterTemplateDiagnostics(lgFile.diagnostics, template) : [];
Expand Down
4 changes: 2 additions & 2 deletions Composer/packages/ui-plugins/luis/src/LuisIntentEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { LuIntentSection } from '@bfc/shared';

const LuisIntentEditor: React.FC<FieldProps<string>> = props => {
const { onChange, value, schema } = props;
const { currentDialog, designerId, luFiles, shellApi, locale } = useShellApi();
const { currentDialog, designerId, luFiles, shellApi, locale, projectId } = useShellApi();
const luFile = luFiles.find(f => f.id === `${currentDialog.id}.${locale}`);

let intentName = value;
Expand Down Expand Up @@ -47,7 +47,7 @@ const LuisIntentEditor: React.FC<FieldProps<string>> = props => {
return (
<LuEditor
height={150}
luOption={{ fileId: luFile.id, sectionId: luIntent.Name }}
luOption={{ fileId: luFile.id, sectionId: luIntent.Name, projectId }}
value={luIntent.Body}
onChange={commitChanges}
diagnostics={diagnostics}
Expand Down