I have developed a very simple Issue extension with main.js as follows:
exports.activate = function() {
}
exports.deactivate = function() {
// Clean up state before the extension is deactivated
}
class IssuesProvider {
provideIssues(editor) {
const options = {
args: ["rubocop", '--disable-pending-cops', '-fj', editor.document.path]
};
let rubocop = new Process("/usr/bin/env", options);
let rawIssues = []
let issues = [];
rubocop.onStdout((line) => { rawIssues.push(line); });
rubocop.onStderr((line) => { console.warn(`Rubocop ERROR: ${line}`); });
rubocop.onDidExit((message) => {
const allIssues = JSON.parse(rawIssues)['files'][0]['offenses'];
allIssues.forEach((offense) => {
console.log(`Rubocop Offnese: ${offense.message}`)
let issue = new Issue();
issue.message = offense['message']
issue.code = offense['cop_name']
issue.severity = IssueSeverity.Error;
issue.column = offense["location"]["start_column"]
// issue.endColumn = offense["location"]["end_column"]
issue.line = offense["location"]["start_line"]
// issue.endLine = offense["location"]["end_line"]
issues.push(issue);
})
console.info(`Rubocop found ${issues.length} issue(s)`);
return issues;
});
rubocop.start();
}
}
nova.assistants.registerIssueAssistant("ruby", new IssuesProvider(), {event: "onChange"});
The console can receive the issues without issue, but nothing is appearing in the Nova user interface with the issue information. Given this mostly folllows the stock example provided when I start creating an Issue extension, I am a bit confused.