MCPcopy Create free account
hub / github.com/compiler-explorer/compiler-explorer / provide

Function provide

static/quick-fixes-handler.ts:57–98  ·  view source on GitHub ↗
(
    model: monaco.editor.ITextModel,
    range: monaco.Range,
    context: monaco.languages.CodeActionContext,
)

Source from the content-addressed store, hash-verified

55}
56
57function provide(
58 model: monaco.editor.ITextModel,
59 range: monaco.Range,
60 context: monaco.languages.CodeActionContext,
61): monaco.languages.CodeActionList {
62 const item = _.find(registeredQuickFixes, (item: RegisteredQuickFixes): boolean => {
63 return item.editorModel === model;
64 });
65
66 if (item) {
67 return {
68 actions: item.fixes.filter(f =>
69 f.diagnostics?.some(d =>
70 context.markers.some(m => {
71 const diagnostic = _.pick(
72 d,
73 'message',
74 'startLineNumber',
75 'startColumn',
76 'endLineNumber',
77 'endColumn',
78 );
79 const marker = _.pick(
80 m,
81 'message',
82 'startLineNumber',
83 'startColumn',
84 'endLineNumber',
85 'endColumn',
86 );
87 return _.isEqual(marker, diagnostic);
88 }),
89 ),
90 ),
91 dispose: () => {},
92 };
93 }
94 return {
95 actions: [],
96 dispose: () => {},
97 };
98}
99
100export function unregister(compilerId: number): void {
101 const item = _.find(registeredQuickFixes, (item: RegisteredQuickFixes): boolean => {

Callers

nothing calls this directly

Calls 1

findMethod · 0.80

Tested by

no test coverage detected