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

Refactoring node code into nodeclient module #2

Merged
merged 2 commits into from
Feb 5, 2015
Merged

Conversation

hinzo
Copy link
Contributor

@hinzo hinzo commented Feb 4, 2015

@steveluc @yuit

This is part one: Only separate the node client out. Part two will add the proxy to make it easier to call the commands on the service.

if jsonObj["type"] == "response":
msgq.put(jsonObj)
else:
print("event:")
Copy link

Choose a reason for hiding this comment

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

Could we remove the print statement? and whoever need it will add the print themselve

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will keep it for now and then remove it when the proxy raises an event which then we can add a print in the event handler.

Copy link

Choose a reason for hiding this comment

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

yep sound good.

@yuit
Copy link

yuit commented Feb 4, 2015

VERY VERY minor stuff : python style uses underscore instead of camel case. I do not if we want to follow Python style guide closely. I just raise this now since we are moving things around

@yuit yuit closed this Feb 4, 2015
@yuit yuit reopened this Feb 4, 2015
@steveluc
Copy link
Contributor

steveluc commented Feb 5, 2015

Great to see some modularity. OK with me to remove all print statements. Was planning to go_to_snake_case. I figured out after I started with camel case that Sublime Text was normalizing to snake case and that python often uses that convention.

Am wondering what would happen if we placed listener class in separate file (would somehow need to get at the singleton client instance). It's about half the code.
👍

@steveluc steveluc closed this Feb 5, 2015
@steveluc steveluc reopened this Feb 5, 2015
self.t.daemon = True
self.t.start()

self.node = NodeClient(procFile)
Copy link
Member

Choose a reason for hiding this comment

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

Consider renaming this to nodeClient to avoid association with AST nodes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@hinzo
Copy link
Contributor Author

hinzo commented Feb 5, 2015

I referred to this for coding guidelines: https://www.python.org/dev/peps/pep-0008/ I don’t see one recommended naming standard. They definitely use different naming standards in the Python library. I just would like us to stay consistent. Here is my preference:

  • I prefer camel casing
  • Pascal casing for classes
  • all lowercase for modules
  • constants are UPPER_CASE

I will look into the listener when I do my other proxy change.

From: Steve Lucco [mailto:notifications@github.com]
Sent: Wednesday, February 4, 2015 9:31 PM
To: Microsoft/TypeScript-Service
Cc: Hani Atassi
Subject: Re: [TypeScript-Service] Refactoring node code into nodeclient module (#2)

Great to see some modularity. OK with me to remove all print statements. Was planning to go_to_snake_case. I figured out after I started with camel case that Sublime Text was normalizing to snake case and that python often uses that convention.

Am wondering what would happen if we placed listener class in separate file (would somehow need to get at the singleton client instance). It's about half the code.
[:+1:]


Reply to this email directly or view it on GitHubhttps://github.com//pull/2#issuecomment-72996639.

@yuit
Copy link

yuit commented Feb 5, 2015

@hinzo I see. I agree with you on consistency. I have no strong preference on naming standard so if that is what you prefer, I will be happy to adopted into the vim-client and use the similar style.

hinzo added a commit that referenced this pull request Feb 5, 2015
Refactoring node code into nodeclient module
@hinzo hinzo merged commit bacceae into master Feb 5, 2015
@DanielRosenwasser
Copy link
Member

To clarify, there is a section for naming conventions:

Prescriptive: Naming Conventions

Function Names

Function names should be lowercase, with words separated by underscores as necessary to improve readability.

Method Names and Instance Variables

Use the function naming rules: lowercase with words separated by underscores as necessary to improve readability.

Constants

Constants are usually defined on a module level and written in all capital letters with underscores separating words. Examples include MAX_OVERFLOW and TOTAL

Though I agree, I prefer camel casing.

@steveluc
Copy link
Contributor

steveluc commented Feb 5, 2015

Camel ok with me. Note sublime will turn camel into snake in for example view.run_command. Also Sublime has conventions such as command classes end in 'command' but this is dropped in command name used for menus and run_command

Sent from my Windows Phone


From: Yuimailto:notifications@github.com
Sent: ý2/ý5/ý2015 12:02 PM
To: Microsoft/TypeScript-Servicemailto:TypeScript-Service@noreply.github.com
Cc: Steve Luccomailto:steveluc@microsoft.com
Subject: Re: [TypeScript-Service] Refactoring node code into nodeclient module (#2)

@hinzohttps://github.com/hinzo I see. I agree with you on consistency. I have no strong preference on naming standard so if that is what you prefer, I will be happy to adopted into the vim-client and use the similar style.


Reply to this email directly or view it on GitHubhttps://github.com//pull/2#issuecomment-73115973.

@hinzo hinzo deleted the sublime_modules branch February 6, 2015 19:13
DanielRosenwasser pushed a commit that referenced this pull request May 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants