Display previous fix from AI error assistant (#19278)

GitOrigin-RevId: 12468956281d11f9ebdc50a2e30e5f8213f68308
This commit is contained in:
Alf Eaton 2024-07-10 12:15:12 +01:00 committed by Copybot
parent 79ec853c4a
commit cfb1a5b82f
6 changed files with 29 additions and 1 deletions

View file

@ -876,6 +876,7 @@ module.exports = {
sourceEditorExtensions: [],
sourceEditorComponents: [],
pdfLogEntryComponents: [],
pdfLogEntriesComponents: [],
diagnosticActions: [],
sourceEditorCompletionSources: [],
sourceEditorSymbolPalette: [],

View file

@ -687,6 +687,7 @@
"last_modified": "",
"last_name": "",
"last_resort_trouble_shooting_guide": "",
"last_suggested_fix": "",
"last_updated_date_by_x": "",
"last_used": "",
"latam_discount_modal_info": "",
@ -715,6 +716,7 @@
"limited_offer": "",
"limited_to_n_editors_per_project": "",
"limited_to_n_editors_per_project_plural": "",
"line": "",
"line_height": "",
"line_width_is_the_width_of_the_line_in_the_current_environment": "",
"link": "",
@ -1333,6 +1335,7 @@
"suggest_fix": "",
"suggested": "",
"suggested_fix_for_error_in_path": "",
"suggestion_applied": "",
"sure_you_want_to_cancel_plan_change": "",
"sure_you_want_to_change_plan": "",
"sure_you_want_to_delete": "",

View file

@ -4,9 +4,12 @@ import { useTranslation } from 'react-i18next'
import PreviewLogsPaneMaxEntries from '../../preview/components/preview-logs-pane-max-entries'
import PdfLogEntry from './pdf-log-entry'
import { useDetachCompileContext } from '../../../shared/context/detach-compile-context'
import importOverleafModules from '../../../../macros/import-overleaf-module.macro'
const LOG_PREVIEW_LIMIT = 100
const pdfLogEntriesComponents = importOverleafModules('pdfLogEntriesComponents')
function PdfLogsEntries({ entries, hasErrors }) {
const { t } = useTranslation()
const { syncToEntry } = useDetachCompileContext()
@ -22,6 +25,12 @@ function PdfLogsEntries({ entries, hasErrors }) {
/>
)}
{pdfLogEntriesComponents.map(
({ import: { default: Component }, path }) => (
<Component key={path} />
)
)}
{logEntries.map((logEntry, index) => (
<PdfLogEntry
key={logEntry.key}

View file

@ -1003,6 +1003,7 @@
"last_modified": "Last Modified",
"last_name": "Last Name",
"last_resort_trouble_shooting_guide": "If that doesnt help, follow our <0>troubleshooting guide</0>.",
"last_suggested_fix": "Last suggested fix",
"last_updated": "Last Updated",
"last_updated_date_by_x": "__lastUpdatedDate__ by __person__",
"last_used": "last used",
@ -1902,6 +1903,7 @@
"suggested": "Suggested",
"suggested_fix_for_error_in_path": "Suggested fix for error in __path__",
"suggestion": "Suggestion",
"suggestion_applied": "Suggestion applied",
"support": "Support",
"sure_you_want_to_cancel_plan_change": "Are you sure you want to revert your scheduled plan change? You will remain subscribed to the <0>__planName__</0> plan.",
"sure_you_want_to_change_plan": "Are you sure you want to change plan to <0>__planName__</0>?",

View file

@ -8,6 +8,7 @@ import {
EditorManager,
EditorManagerContext,
} from '@/features/ide-react/context/editor-manager-context'
import { EditorView } from '@codemirror/view'
describe('<PdfLogsEntries/>', function () {
const fakeFindEntityResult: FindResult = {
@ -57,6 +58,10 @@ describe('<PdfLogsEntries/>', function () {
},
]
const scope = {
'editor.view': new EditorView({ doc: '\\documentclass{article}' }),
}
beforeEach(function () {
cy.interceptCompile()
cy.interceptEvents()
@ -64,7 +69,7 @@ describe('<PdfLogsEntries/>', function () {
it('displays human readable hint', function () {
cy.mount(
<EditorProviders>
<EditorProviders scope={scope}>
<PdfLogsEntries entries={logEntries} />
</EditorProviders>
)
@ -75,6 +80,7 @@ describe('<PdfLogsEntries/>', function () {
it('opens doc on click', function () {
cy.mount(
<EditorProviders
scope={scope}
providers={{ EditorManagerProvider, FileTreePathProvider }}
>
<PdfLogsEntries entries={logEntries} />
@ -104,6 +110,7 @@ describe('<PdfLogsEntries/>', function () {
cy.mount(
<EditorProviders
scope={scope}
providers={{ EditorManagerProvider, FileTreePathProvider }}
>
<PdfLogsEntries entries={logEntries} />
@ -143,6 +150,7 @@ describe('<PdfLogsEntries/>', function () {
cy.mount(
<EditorProviders
scope={scope}
providers={{ EditorManagerProvider, FileTreePathProvider }}
>
<PdfLogsEntries entries={logEntries} />

View file

@ -1,3 +1,5 @@
import { EditorView } from '@codemirror/view'
export const mockScope = () => ({
settings: {
syntaxValidation: false,
@ -8,6 +10,9 @@ export const mockScope = () => ({
doc_id: 'test-doc',
getSnapshot: () => 'some doc content',
},
view: new EditorView({
doc: '\\documentclass{article}',
}),
},
hasLintingError: false,
ui: {