|
|
@ -24,12 +24,14 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi |
|
|
|
const errStrings: string[] = Object.keys(fixesList) |
|
|
|
const errStrings: string[] = Object.keys(fixesList) |
|
|
|
const errStr: string = errStrings.find((es) => error.message.includes(es)) |
|
|
|
const errStr: string = errStrings.find((es) => error.message.includes(es)) |
|
|
|
if (errStr) { |
|
|
|
if (errStr) { |
|
|
|
|
|
|
|
console.log('error=========>', error) |
|
|
|
fixes = fixesList[errStr] |
|
|
|
fixes = fixesList[errStr] |
|
|
|
const cursorPosition: number = this.props.editorAPI.getHoverPosition({ |
|
|
|
const cursorPosition: number = this.props.editorAPI.getHoverPosition({ |
|
|
|
lineNumber: error.startLineNumber, |
|
|
|
lineNumber: error.startLineNumber, |
|
|
|
column: error.startColumn |
|
|
|
column: error.startColumn |
|
|
|
}) |
|
|
|
}) |
|
|
|
const nodeAtPosition = await this.props.plugin.call('codeParser', 'definitionAtPosition', cursorPosition) |
|
|
|
const nodeAtPosition = await this.props.plugin.call('codeParser', 'definitionAtPosition', cursorPosition) |
|
|
|
|
|
|
|
console.log('nodeAtPosition=========>', nodeAtPosition) |
|
|
|
// Check if a function is hovered
|
|
|
|
// Check if a function is hovered
|
|
|
|
if (nodeAtPosition && nodeAtPosition.nodeType === 'FunctionDefinition') { |
|
|
|
if (nodeAtPosition && nodeAtPosition.nodeType === 'FunctionDefinition') { |
|
|
|
// Identify type of AST node
|
|
|
|
// Identify type of AST node
|
|
|
@ -72,6 +74,17 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi |
|
|
|
}) |
|
|
|
}) |
|
|
|
break |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
case 9.1: |
|
|
|
|
|
|
|
case 9.2: { |
|
|
|
|
|
|
|
const lineContent: string = model.getValueInRange(error) |
|
|
|
|
|
|
|
const words = lineContent.split(' ') |
|
|
|
|
|
|
|
this.addQuickFix(actions, error, model.uri, { |
|
|
|
|
|
|
|
title: fix.title, |
|
|
|
|
|
|
|
range: error, |
|
|
|
|
|
|
|
text: words[0] + fix.message + words[1] |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
} |
|
|
|
default: |
|
|
|
default: |
|
|
|
this.addQuickFix(actions, error, model.uri, { |
|
|
|
this.addQuickFix(actions, error, model.uri, { |
|
|
|
title: fix.title, |
|
|
|
title: fix.title, |
|
|
|