Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup Message Registry #738

Merged

Conversation

steelbrain
Copy link
Owner

To be merged into #737
Fixes #716
Fixes #650
Ref: #708

Reviewers

@steelbrain
Copy link
Owner Author

Everything works, except the count on the bottom and line messages, working on them.

@steelbrain steelbrain mentioned this pull request Jul 15, 2015
2 tasks
@steelbrain
Copy link
Owner Author

I am done with it. Tests seem to pass and everything seems okay.

@@ -35,6 +33,10 @@ class EditorLinter
onDidDestroy: (callback) ->
return @emitter.on('did-destroy', callback)

destroy: ->
@emitter.emit('did-destroy')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be at the end of the function since it is did-destroy not will-destroy?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's actually called after TextEditor is destroyed, not before it, here we are emulating the same event, to support the linter:toggle command and emulate a TextEditor destruction.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@steelbrain, he means that it should be done after @deactivate() is called so it represents that deactivate succeeded correctly.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if it'll change anything, but I'll still do it 👏

text = message.text || message.html
toReturn = message.type + '-' + message.filePath + '-' + (message.range?.serialize?()) + '-' + text
return toReturn.toLowerCase()
shouldTriggerLinter: (linter, bufferModifying, onChange, scopes) ->
# Trigger fly linters on save, but not save linters on fly

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is confusing. It should probably refer to "fly linters" as "on-the-fly linters".

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


getMessages: ->
return @messages.getAll()
return @messages.publicMessages

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove explicit return

render: ->
@messages = @linter.messages.getAllMessages()
render: (messages) ->
@messages = @classifyMessagesByLine(@classifyMessages(messages))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you ever call classifyMessagesByLine or classifyMessages separate from each other? If not, then one should call the other.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

if @updated
@updated = false
publicMessages = []
@messages.forEach (messages) -> publicMessages = publicMessages.concat(messages)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should probably be:

@messages.forEach (message) -> publicMessages.push(message)

Singular name on the anonymous function parameter because it is passing in a single message. And push probably doesn't needlessly allocate another object.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@messages is actually a array<Linter, array<Message>> so we need to iterate over editorMessages and then get the messages and then concat them as one array.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@steelbrain, we need to rename @messages to something else then. Perhaps @linterResponses?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -110,6 +112,6 @@ class Linter
@views.destroy()
@linters.deactivate()
@commands.destroy()
@messages.destroy()
@messages.deactivate()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should really rename all these things dispose so that we are implementing the disposable interface.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then as we build them we can just register them into a composite disposable and just dispose it.

@park9140
Copy link

🚢 after adding tests.

@steelbrain
Copy link
Owner Author

@park9140 everything that was introduced in this PR has tests for it, I'll be adding tests for other stuff incrementally.

steelbrain added a commit that referenced this pull request Jul 22, 2015
@steelbrain steelbrain merged commit 74bacf8 into steelbrain/import-linter-registry Jul 22, 2015
@steelbrain steelbrain deleted the steelbrain/upgrade-message-registry branch July 22, 2015 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants