Skip to content
This repository was archived by the owner on Apr 6, 2018. It is now read-only.

Conversation

@t9md
Copy link
Contributor

@t9md t9md commented Aug 8, 2015

This PR introduce new generate-introspection-report command which generate introspection report as markdown format to untitled buffer.

This is not enhancement to Vim feature, this introspection command sometime useful for vim-mode developer to get overview of each TextObject, Operator, Motion.

This introspection parse Function.toString() to find instance variable assignment and super call.
Not 100% accurate(parsing JavaScript function written in CoffeScript), but useful.

@jacekkopecky
Copy link
Contributor

jacekkopecky commented Aug 8, 2015 via email

@t9md
Copy link
Contributor Author

t9md commented Aug 8, 2015

Please add a date to the generated report, and vim-mode package version,
and if possible also current git commit ID, so it's easy to see if the
report is up to date.

Will do, I'm not sure for git commit ID, will try.
Currently the generated file will written to under ~/github/vim-mode/docs, which will convenient to update docs without moving file.
But if we add time, version, and commit ID, we'd better to write generated file to temporary file.

Would it be possible/useful to output as the first part a subclass tree
rather than an unordered list of subclass relationships?

I couldn't understand above, how does it like? I want some example.

@t9md t9md force-pushed the add-introspection branch from 5faa998 to 8480ad4 Compare August 8, 2015 16:42
@t9md
Copy link
Contributor Author

t9md commented Aug 8, 2015

Now removed TOM-report.md itself from docs/ dir. since its now written under tmpdir.
If maintainer need to include report, he need to manually move under docs.

By the way, if this reflection utility be merged, I can add realtime opStack observation feature.
Its also helpful to new developer understand how vim-mode works whey they try to add new TOM.

@jacekkopecky
Copy link
Contributor

Regarding hierarchy: currently, your output is

and I think it would be useful to have it sorted alphabetically and nested by subclassing like this

@jacekkopecky
Copy link
Contributor

The more and more I'm looking at this, the more it looks like it could be an Atom package independent of vim-mode, which would take the current project's coffee files and run this type of introspection on their exports.

Also, instead of generating a file, how about opening a new text editor and putting the content there? Then the user can choose where to save it, if at all.

@t9md
Copy link
Contributor Author

t9md commented Aug 9, 2015

Its good idea to save non-named buiffer and let user choose where to save.
For orders hiararchy its possible but I don't have such motivation currently.

The independend Package idea is good, maybe me or other person introduce in future.

My motivation is to introduce opStack ovservation feature on top of this introspection helper utility function to help developer.

Its already very useful to understand where to be fixed while refactoring in my refactor ecoeriment. I can directly spot what class operator is operate on when some operator throw error.

@t9md t9md force-pushed the add-introspection branch from 658b178 to f441216 Compare August 11, 2015 13:41
@t9md
Copy link
Contributor Author

t9md commented Aug 11, 2015

Updated first comment to fit to current implementation.

Here is the summary of change from first PR.

  • Change command name generate-reflection-report to generate-introspection-report.
  • Now table of content reflect inheritance hierarchy.
  • Most of code moved from vim-state.cofee to introspection.coffee.

@maxbrunsfeld
Copy link
Contributor

This is a really cool technique, but I don't think this code belongs inside of vim-mode. Maybe it should be a separate npm module, like @jacekkopecky said. It could be an executable, for example, that you run with any given node.js code, like this:

$ generate-introspection-report ~/.atom/packages/vim-mode/lib/*.coffee

@t9md
Copy link
Contributor Author

t9md commented Aug 12, 2015

Your example seem that command is executed separate process to statically analyze coffee source.
But my code is for dynamically introspect within vim-mode.

The main purpose of this addition is to add osStack observation(=debugging) feature to vim-mode on top of this introspection function.
Here is the example output of opStack observation and explanation of how operation stack works.
How Operation Stack works(for current official vim-mode)

Its very useful to developer adding or refactoring vim-mode.

Also this introspection report can be used to explain overall change between large commit by comparing to past report.
Here is example when I removed MotionWithInput intermediate class in my vim-mode folk.

@t9md t9md closed this Nov 7, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants