Skip to content

Commit

Permalink
fix editor warning (microsoft#2446)
Browse files Browse the repository at this point in the history
Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com>
  • Loading branch information
zhixzhan and cwhitten authored Mar 31, 2020
1 parent 5000113 commit 8632029
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Composer/packages/lib/indexers/src/utils/diagnosticUtil.ts
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

0 comments on commit 8632029

Please sign in to comment.