Howdy.
In light of the recent C Library bundle, it's obvious that people re extremely interested in having some code completion in TextMate.
I've done a few things will code completion already. Filepath - http://subtlegradient.com/articles/2006/11/02/filename- filepath-completion-for-textmate-screencast English - http://subtlegradient.com/articles/2006/10/30/english-word- completion-for-textmate-screencast And someone did Cocoa completions http://theocacao.com/document.page/332
I think we should come up with a brick simple library that will let you do completions. Then the hardcode d00ds can get on with extending and perfecting the completion library. While everyone actually gets the chance to use it.
Plus, we'll be able to unify all the code completion stuff into a single library.
thomas Aylott — design42 — subtleGradient — CrazyEgg
Is there any documentation available on how one is to make code completion part of a bundle?
-Brian
On 12/6/06, thomas Aylott oblivious@subtlegradient.com wrote:
Howdy.
In light of the recent C Library bundle, it's obvious that people re extremely interested in having some code completion in TextMate.
I've done a few things will code completion already. Filepath
English
And someone did Cocoa completions http://theocacao.com/document.page/332
I think we should come up with a brick simple library that will let you do completions. Then the hardcode d00ds can get on with extending and perfecting the completion library. While everyone actually gets the chance to use it.
Plus, we'll be able to unify all the code completion stuff into a single library. thomas Aylott — design42 — subtleGradient — CrazyEgg
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
There is no easy way to do code completion in TextMate yet. A tool to show a menu that you can select from is available, but none of the rest of the functionality yet. You have to get the current text and parse it and then return the final result and everything in between yourself.
But that's what I'm hoping to instigate here. An library or something that you can just pass a comma separated list or something.
How do you want it to work?
thomas Aylott — design42 — subtleGradient — CrazyEgg
On Dec 6, 2006, at 5:53 PM, Brian Landau wrote:
Is there any documentation available on how one is to make code completion part of a bundle?
-Brian
On 12/6/06, thomas Aylott oblivious@subtlegradient.com wrote:
Howdy.
In light of the recent C Library bundle, it's obvious that people re extremely interested in having some code completion in TextMate.
I've done a few things will code completion already. Filepath
completion-for-textmate-screencast English
completion-for-textmate-screencast And someone did Cocoa completions http://theocacao.com/document.page/332
I think we should come up with a brick simple library that will let you do completions. Then the hardcode d00ds can get on with extending and perfecting the completion library. While everyone actually gets the chance to use it.
Plus, we'll be able to unify all the code completion stuff into a single library. thomas Aylott — design42 — subtleGradient — CrazyEgg
Brian Landau wrote:
On 12/6/06, thomas Aylott oblivious@subtlegradient.com wrote:
In light of the recent C Library bundle, it's obvious that people re extremely interested in having some code completion in TextMate.
Is there any documentation available on how one is to make code completion part of a bundle?
Nope. That's the reason to make some generic libraries for it which could be used by multiple languages. The current method has everyone re-inventing the wheel, and copying existing things to make new ones.
Thomas: I think that's an absolutely wonderful idea; why don't we use this thread to gather the use cases (i.e. all the forms that such completion can take, for different languages, etc. so we can make this work for everyone).
For C, there's some generic set of functions that should be included (probably similar to those in the "C Library" bundle, but I would also like to support arbitrary header files sourced in the current file. The snippets inserted by the "C Library" bundle do just about what they should do, but of course, we should be able to complete before typing the full function name. Also, ordering the list will be a bit tricky. I don't think it should just be alphabetical; for instance, functions already used in the current document should come sooner than others.
For python, it would be great if we could get the whole standard library, though it's going to be a bit tricky, given how imported modules can be renamed, etc.
-Jacob
On 7-dec-2006, at 0:39, Jacob Rus wrote:
For C, there's some generic set of functions that should be included (probably similar to those in the "C Library" bundle, but I would also like to support arbitrary header files sourced in the current file. The snippets inserted by the "C Library" bundle do just about what they should do, but of course, we should be able to complete before typing the full function name. Also, ordering the list will be a bit tricky. I don't think it should just be alphabetical; for instance, functions already used in the current document should come sooner than others.
Here is some experience from the outside, BBEdit to be precise. BBEdit does not offer code or even word completion (at all). An external tool is available to soften that blow [1]. If apple events are available, it is possible to hook it up to TextMate.
In my experience it works well enough for LaTeX code where you have a lot of private macros (in which case a list of additional names is useless anyway). Just make sure you have the file with the definitions open, and the command definition alone is enough to find the right completion.
For programming where a lot of the required word-lists may be from external libraries, this is less useful (although it certainly promotes the use of long variable names, generally improving code readability). Since the file contents are all passed along through AppleEvents, it should be easy to capture the call, and fake a document with all library function names. The order in which possible completions are found is working, and worth copying. Right now repeated calls cycle through possible completions, an Xcode like drop- down menu is probably a bit better in the long run.
HTMH,
Maarten
On 06/12/06, Jacob Rus jrus@hcs.harvard.edu wrote:
For python, it would be great if we could get the whole standard library, though it's going to be a bit tricky, given how imported modules can be renamed, etc.
Some aspects of Python would be reasonably easy. Most import statements are at the top of the file and are easy to parse. One could write a command that does a dir() on each of those modules, and when you type the module name followed by a dot, it offers the contents of that dir(). It could be activated on typing dot, which then scans back for the last whole word and sees if it knows that as a module.
I'd be willing to have a go at this, but I don't know how to present a drop down or scan back for the last word when a dot is pressed. I'll see if I can get the import parsing working though as a starter.
Ed
First off: it's great that this subject comes up, for indeed: (automatic) code completion is also the TOP1 item on *my* TextMate wishlist. But let me grab the opportunity of blatantly list some of the features I would request for such code completion.
On 6-dec-2006, at 22:41, thomas Aylott wrote:
I think we should come up with a brick simple library that will let you do completions. Then the hardcode d00ds can get on with extending and perfecting the completion library. While everyone actually gets the chance to use it.
I'm not sure if I got you right, thomas. I think that a flat (Library) file is the not the solution swe're looking for here – other than just a temporary one too keep the svn manageable ;)–. I think the system for our code completion should be much more complex and *context-aware* than that. Like the filename-filepath-completion- for-textmate you showed; that didn't work with a flat library file, or did it?
On 7-dec-2006, at 0:39, Jacob Rus wrote:
I don't think it should just be alphabetical; for instance, functions already used in the current document should come sooner than others.
Indeed, or even better: that it has the learning behavior –like the ⎋ completion in TextMate already has now– : frequently (or previously) used completions will show up first.
@Ed Singleton: That would be great! I think python would be a good case to start building such a smart system, because of its extensive introspection. Take a look at ipython (the alternative interactive python interpreter), if you haven't already. Good code completion systems would strongly work with the context in which the completion is requested. And luckily for us TextMate already has a great scope (context) system. For code completions that would imply that only the functions, methods or properties show up that object or context is susceptible to.
Or it could be even more context aware, for instance that it also takes into account in which code block you are working. E.g. (seen in Xcode) Inside the method doSomethingWithFoo: of class Bar, we call a totally different class Baz, which happen to have the same method doSomethingWithFoo. Then before you type anything more than `[Baz ` it already show doSomethingWithFoo as the first completion.
So ordering the completions is a big issue, possible of saving us hours and hours.
As the final feature to list I also want to mention that I would be a fan of *SubWordCompletion*. (This used to be a feature of Xcode, but they removed it, unfortunately). With SubWordCompletion I mean that it can also complete on *parts* of completion terms, without leaving the completion modus, with the possibility to narrow down on the completion term fast. An example: You're looking for NSNumberFormatterRoundDown. Then typing `NSNum ⇥ F ⇥ R ⇥ D ⇥` should be enough to make the complete NSNumberFormatterRoundDown. This would the breakdown of the steps in the interface: 1. You type NSNum It completes to NSNumber 2. type ⇥ It stays in completion mode, showing you all possible continuations of NSNumber... (Hit ⇥ again or hit enter to exit completion mode and use NSNumber) 3. type F it completes to NSNumberFormatter 4. type ⇥ you see NSNumberFormatter... and still stays in completion mode 5. type R it completes to NSNumberFormatterRound 6. type ⇥ you see the 9 possible endings of NSNumberFormatterRound... 7. type D it completes to NSNumberFormatterRoundDown 8. type ⇥ presto!
I recognize that most of these features will not be simple to implement, but please forgive me for being an idealist instead of a pragmatist. Best, dirk
I would like to add my vote for strongly considering code completion in TM. It's the one area that I've had to work around in replacing my old web development tools. I abhor wizards and the like, but when I'm in the middle of typing 'text' in a stylesheet, it's really nice to have it offer me '-indent' and '-decoration', etc. Upon selecting an option (pressing enter) I'm used to it determining the context and building the necessary structure, in this case the colon and semicolon. CSSEdit does a pretty decent job with this type of completion, within the realm of a CSS file, of course.
Personally, I agree with the earlier sentiment that if a solid code completion base were built, then those of us with language specific needs could begin tweaking and building the necessary libraries for each language. This would be a huge boon to TM, IMHO.
Brett
On 7 Dec 2006, at 13:17, Brett Terpstra wrote:
Personally, I agree with the earlier sentiment that if a solid code completion base were built, then those of us with language specific needs could begin tweaking and building the necessary libraries for each language. This would be a huge boon to TM, IMHO.
I agree - although code completion is much harder for, say, ObjC where you really have to parse a lot of code to know the type of an object and therefore the messages it's likely to respond to.
Definitely +1 for an API that would allow such a thing to be built though.
On Dec 7, 2006, at 6:51 AM, Dirk van Oosterbosch, IR labs wrote:
First off: it's great that this subject comes up, for indeed: (automatic) code completion is also the TOP1 item on *my* TextMate wishlist. But let me grab the opportunity of blatantly list some of the features I would request for such code completion.
On 6-dec-2006, at 22:41, thomas Aylott wrote:
I think we should come up with a brick simple library that will let you do completions. Then the hardcode d00ds can get on with extending and perfecting the completion library. While everyone actually gets the chance to use it.
I'm not sure if I got you right, thomas. I think that a flat (Library) file is the not the solution swe're looking for here – other than just a temporary one too keep the svn manageable ;)–. I think the system for our code completion should be much more complex and *context-aware* than that. Like the filename-filepath- completion-for-textmate you showed; that didn't work with a flat library file, or did it?
On 7-dec-2006, at 0:39, Jacob Rus wrote:
I don't think it should just be alphabetical; for instance, functions already used in the current document should come sooner than others.
Indeed, or even better: that it has the learning behavior –like the ⎋ completion in TextMate already has now– : frequently (or previously) used completions will show up first.
@Ed Singleton: That would be great! I think python would be a good case to start building such a smart system, because of its extensive introspection. Take a look at ipython (the alternative interactive python interpreter), if you haven't already. Good code completion systems would strongly work with the context in which the completion is requested. And luckily for us TextMate already has a great scope (context) system. For code completions that would imply that only the functions, methods or properties show up that object or context is susceptible to.
Or it could be even more context aware, for instance that it also takes into account in which code block you are working. E.g. (seen in Xcode) Inside the method doSomethingWithFoo: of class Bar, we call a totally different class Baz, which happen to have the same method doSomethingWithFoo. Then before you type anything more than `[Baz ` it already show doSomethingWithFoo as the first completion.
…
I recognize that most of these features will not be simple to implement, but please forgive me for being an idealist instead of a pragmatist. Best, dirk
This is just the time for idealism! Please continue being idealistic. All of us need to consider the absolute best way to make this work. No sense being pragmatic about something nobody wants
I totally agree that contextually aware smart code completion is my goal. But, we have to start somewhere ;)
I think the focus for a 1.0 version of codecompletion would be to work with a static list of completions But make that completer thing extendable to support dynamic contextual lists and whatnot.
A few languages will be easier to scan than others. Rails is my main goal here, and for that I think opening up a rails console in the background with a customized DRB connection will allow very quick response time to everything that the Rails console can give you.
I figure the crazy python people will want to make the python importer themselves. I'm planning on doing Ruby and Rails and HTML and Javascript and Javascript Prototype and maybe CSS, unless someone beats me to it ;)
Next up… the breakdown of the specific tasks
On Dec 7, 2006, at 6:51 AM, Dirk van Oosterbosch, IR labs wrote:
As the final feature to list I also want to mention that I would be a fan of *SubWordCompletion*. (This used to be a feature of Xcode, but they removed it, unfortunately). With SubWordCompletion I mean that it can also complete on *parts* of completion terms, without leaving the completion modus, with the possibility to narrow down on the completion term fast. An example: You're looking for NSNumberFormatterRoundDown. Then typing `NSNum ⇥ F ⇥ R ⇥ D ⇥` should be enough to make the complete NSNumberFormatterRoundDown. This would the breakdown of the steps in the interface:
- You type NSNum
It completes to NSNumber 2. type ⇥ It stays in completion mode, showing you all possible continuations of NSNumber... (Hit ⇥ again or hit enter to exit completion mode and use NSNumber) 3. type F it completes to NSNumberFormatter 4. type ⇥ you see NSNumberFormatter... and still stays in completion mode 5. type R it completes to NSNumberFormatterRound 6. type ⇥ you see the 9 possible endings of NSNumberFormatterRound... 7. type D it completes to NSNumberFormatterRoundDown 8. type ⇥ presto!
I recognize that most of these features will not be simple to implement, but please forgive me for being an idealist instead of a pragmatist. Best, dirk
This can't work with tm_dialog--menu as it currently exists. However! all the tm_dialog source code is in the repo. I have no idea, but could you extend the tm_dialog --menu to catch keystrokes and pass them back? If so, then we could implement this functionality.
OR
We could use a custom nib inside of tm_dialog instead of the --menu I think we could even use Allan's borderless panel subclass. Then it would look a lot more like the normal code completion thing that every other cocoa app uses.
There have been a bunch of changes to tm_dialog lately, anyone know how doable this is? I know there's something to keep the nib open while sending messages to and from it now.
thomas Aylott — design42 — subtleGradient — CrazyEgg
On Dec 7, 2006, at 9:37 AM, thomas Aylott wrote:
We could use a custom nib inside of tm_dialog instead of the --menu I think we could even use Allan's borderless panel subclass. Then it would look a lot more like the normal code completion thing that every other cocoa app uses.
There have been a bunch of changes to tm_dialog lately,
(If by 'lately' you mean r6308. :)
anyone know how doable this is?
Should be doable -- though maybe not quite as nice as the standard UI, because there's (currently) no way to autoresize the window to conform to the text size. Create a nib with an NSPanel; set the Custom Subclass of the window to the borderless subclass already present in TM. Add an NSTextView (graphics/fonts disabled) for the completion text and an NSTableView for the suggested completions; for the NSTextField value binding, set the 'Continously updates value' check box. The main loop would look something like:
dialog.wait_for_input do | input | user_text = input['completionText'] suggestions = completions_for(user_text) # Subword completion if user_text.end_with?(TabKeyChar) then user_text = common_prefix_of_strings(suggestions) || user_text.sub(/ #{TabKeyChar}$/, '') end
dialog.parameters = {'completionText' => user_text; 'suggestedCompletions' => suggestions} end
Chris
On Dec 6, 2006, at 4:41 PM, thomas Aylott wrote:
Howdy.
In light of the recent C Library bundle, it's obvious that people re extremely interested in having some code completion in TextMate.
I've done a few things will code completion already. Filepath - http://subtlegradient.com/articles/2006/11/02/filename- filepath-completion-for-textmate-screencast English - http://subtlegradient.com/articles/2006/10/30/english- word-completion-for-textmate-screencast And someone did Cocoa completions http://theocacao.com/document.page/332
I think we should come up with a brick simple library that will let you do completions. Then the hardcode d00ds can get on with extending and perfecting the completion library. While everyone actually gets the chance to use it.
Plus, we'll be able to unify all the code completion stuff into a single library.
thomas Aylott — design42 — subtleGradient — CrazyEgg
On Dec 6, 2006, at 5:48 PM, Max wrote:
Jacob Rus schrieb:
- I hope it becomes slightly easier to make generic completion
commands in the future, because at the moment, I'm not sure it can be done by a complete newbie, and it's a useful enough feature that it would be nice to give even new users such power. Allan is hopefully considering such things for TextMate 2.0.
Bit of the wrong topic... Having function completion like SubEthaEdit or Xcode ( even better would be if the completion also inserts the paramters a function takes) is TOP1 on my Wishlist for TM2. I always have to look this up in the docs :) see http://schlabber-dog.com/ext/function_completion.jpg
What languages do you need it to work for? I assume PHP at least since that screenshot.
Personally, I want all the default Ruby functions, classes and methods. And all the Rails functions classes and methods. And all of my own custom functions classes, methods, variables and anything else I can think of.
Oh, and javascript, html, various javascript libraries, css and hmm.... that's it for me ;)
Yeah, php, css, html, Javascript, yeah those are I assume the standard start. Then yeah Ruby and Rails. I guess also XML/XSLT/XSD/XFroms/X??? support would be amazing
-Brian
On 12/6/06, thomas Aylott oblivious@subtlegradient.com wrote:
On Dec 6, 2006, at 4:41 PM, thomas Aylott wrote:
Howdy.
In light of the recent C Library bundle, it's obvious that people re extremely interested in having some code completion in TextMate.
I've done a few things will code completion already. Filepath - http://subtlegradient.com/articles/2006/11/02/filename- filepath-completion-for-textmate-screencast English - http://subtlegradient.com/articles/2006/10/30/english- word-completion-for-textmate-screencast And someone did Cocoa completions http://theocacao.com/document.page/332
I think we should come up with a brick simple library that will let you do completions. Then the hardcode d00ds can get on with extending and perfecting the completion library. While everyone actually gets the chance to use it.
Plus, we'll be able to unify all the code completion stuff into a single library.
thomas Aylott — design42 — subtleGradient — CrazyEgg
On Dec 6, 2006, at 5:48 PM, Max wrote:
Jacob Rus schrieb:
- I hope it becomes slightly easier to make generic completion
commands in the future, because at the moment, I'm not sure it can be done by a complete newbie, and it's a useful enough feature that it would be nice to give even new users such power. Allan is hopefully considering such things for TextMate 2.0.
Bit of the wrong topic... Having function completion like SubEthaEdit or Xcode ( even better would be if the completion also inserts the paramters a function takes) is TOP1 on my Wishlist for TM2. I always have to look this up in the docs :) see http://schlabber-dog.com/ext/function_completion.jpg
What languages do you need it to work for? I assume PHP at least since that screenshot.
Personally, I want all the default Ruby functions, classes and methods. And all the Rails functions classes and methods. And all of my own custom functions classes, methods, variables and anything else I can think of.
Oh, and javascript, html, various javascript libraries, css and hmm.... that's it for me ;)
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
Le 7 déc. 06 à 00:26, thomas Aylott a écrit :
On Dec 6, 2006, at 4:41 PM, thomas Aylott wrote:
Howdy.
In light of the recent C Library bundle, it's obvious that people re extremely interested in having some code completion in TextMate.
I've done a few things will code completion already. Filepath - http://subtlegradient.com/articles/2006/11/02/filename- filepath-completion-for-textmate-screencast English - http://subtlegradient.com/articles/2006/10/30/english- word-completion-for-textmate-screencast And someone did Cocoa completions http://theocacao.com/document.page/332
I would like to do the same things for LaTeX ! Do you think it is possible by a newbie like me?
Alain
Ok. There are now a bunch of people that have signed on to work on this thing.
Time to start divvying up the workload.
#1: First, we need a Ruby Class for the core essentials of the completion stuff. It needs to: Be an external library that can be called from a hundred different tmCommands Be fully runnable from the terminal by manually passing in all the arguments (so, use the TM_* vars only as fallback) Get the text you're in the middle of writing Get the list of completions based on that text from somewhere (see #2) Show the menu and let you make your selection Return a snippet with the results
#2: To go with the first one, we need to define the format that the list will be in. Plist format, simple or xml or binary This list will either be: the contents of a static file or a command that returns the list in the necessary format (this is where you could write something smart to parse stuff) I'd like to use the .completions file extenstion, maybe .tmCompletions ? Eventually we could pressure Allan into more advanced support for it ;)
Once we have the basic format (#2) and the basic completer (#1), we can… (#3)
#3: Start writing static plist lists of completions. This is not ideal for all languages, obviously, but will make the completer useful quickly. Best for code like HTML that is just what it is. HTML 4 XHTML CSS JavaScript Core Stuff
#3.5: tmCompletions generators. Maybe something that will parse your entire Rails application and manually create a code completion list of all the Classes and methods. Maybe something to convert an hdoc into a codecompletion list
While some people are busy with #3, other people can get on with #4
#4: My real goal of this whole thing. Dynamic lists. I figure this part will take the form of various plugins for various languages and libraries and your own personal code libraries and whatever you like. Could be based on stuff done in #3.5 We need to work with #1 and #2 to make sure everything needed for #4 is available and extendable.
Ok, so who wants to do what? Personally, I want to do all of it, but i have a job and a family and other stuff I need to do. So i guess we should divvy it up and get it done faster.
thomas Aylott — design42 — subtleGradient — CrazyEgg
Count me in for #3 when #2 is ready. I have a solid knowledge of HTML, XHTML and CSS and could work within the parameters of a static file or command just fine. I'm happy to put effort in wherever needed.
Brett
On Dec 7, 2006, at 9:06 AM, thomas Aylott wrote:
Ok. There are now a bunch of people that have signed on to work on this thing.
Time to start divvying up the workload.
#1: First, we need a Ruby Class for the core essentials of the completion stuff. It needs to: Be an external library that can be called from a hundred different tmCommands Be fully runnable from the terminal by manually passing in all the arguments (so, use the TM_* vars only as fallback) Get the text you're in the middle of writing Get the list of completions based on that text from somewhere (see #2) Show the menu and let you make your selection Return a snippet with the results
#2: To go with the first one, we need to define the format that the list will be in. Plist format, simple or xml or binary This list will either be: the contents of a static file or a command that returns the list in the necessary format (this is where you could write something smart to parse stuff) I'd like to use the .completions file extenstion, maybe .tmCompletions ? Eventually we could pressure Allan into more advanced support for it ;)
Once we have the basic format (#2) and the basic completer (#1), we can… (#3)
#3: Start writing static plist lists of completions. This is not ideal for all languages, obviously, but will make the completer useful quickly. Best for code like HTML that is just what it is. HTML 4 XHTML CSS JavaScript Core Stuff
#3.5: tmCompletions generators. Maybe something that will parse your entire Rails application and manually create a code completion list of all the Classes and methods. Maybe something to convert an hdoc into a codecompletion list
While some people are busy with #3, other people can get on with #4
#4: My real goal of this whole thing. Dynamic lists. I figure this part will take the form of various plugins for various languages and libraries and your own personal code libraries and whatever you like. Could be based on stuff done in #3.5 We need to work with #1 and #2 to make sure everything needed for #4 is available and extendable.
Ok, so who wants to do what? Personally, I want to do all of it, but i have a job and a family and other stuff I need to do. So i guess we should divvy it up and get it done faster.
thomas Aylott — design42 — subtleGradient — CrazyEgg
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
Hey there all,
Thanks for getting this idea of off the ground Thomas. I'm really pleased that we're starting a potentially fruitful dialogue on this. I think that it's a great idea - particularly for languages where it is simple (I'm thinking html, css here). Also, there has been a lot of talk about whether code completion for dynamic languages such as Ruby is even possible, however I think that if we follow the 80/20 rule, we don't need to aim for perfection, just to help people in the majority of situations.
Also, I'd like to suggest that we actively build a corresponding suite of tests alongside the development of this tool/library/suite.
It would be great to be in a position to say 'hey, the code completion doesn't work as expected for this case, so I've written a test to capture it, and here's a corresponding patch to fix it'. I feel we should follow the Rails implementation methodology and not allow patches/improvements without corresponding tests.
The important things here aren't just that we'd get fixes for things, and tests to make sure the bugs never return, but we start to create a language to help define what we collectively 'expect' from a code completion tool, as I'm sure there is a bit of ambiguity here.
Cheers, Sam Aaron
On 7 Dec 2006, at 3.06 pm, thomas Aylott wrote:
Ok. There are now a bunch of people that have signed on to work on this thing.
Time to start divvying up the workload.
#1: First, we need a Ruby Class for the core essentials of the completion stuff. It needs to: Be an external library that can be called from a hundred different tmCommands Be fully runnable from the terminal by manually passing in all the arguments (so, use the TM_* vars only as fallback) Get the text you're in the middle of writing Get the list of completions based on that text from somewhere (see #2) Show the menu and let you make your selection Return a snippet with the results
#2: To go with the first one, we need to define the format that the list will be in. Plist format, simple or xml or binary This list will either be: the contents of a static file or a command that returns the list in the necessary format (this is where you could write something smart to parse stuff) I'd like to use the .completions file extenstion, maybe .tmCompletions ? Eventually we could pressure Allan into more advanced support for it ;)
Once we have the basic format (#2) and the basic completer (#1), we can… (#3)
#3: Start writing static plist lists of completions. This is not ideal for all languages, obviously, but will make the completer useful quickly. Best for code like HTML that is just what it is. HTML 4 XHTML CSS JavaScript Core Stuff
#3.5: tmCompletions generators. Maybe something that will parse your entire Rails application and manually create a code completion list of all the Classes and methods. Maybe something to convert an hdoc into a codecompletion list
While some people are busy with #3, other people can get on with #4
#4: My real goal of this whole thing. Dynamic lists. I figure this part will take the form of various plugins for various languages and libraries and your own personal code libraries and whatever you like. Could be based on stuff done in #3.5 We need to work with #1 and #2 to make sure everything needed for #4 is available and extendable.
Ok, so who wants to do what? Personally, I want to do all of it, but i have a job and a family and other stuff I need to do. So i guess we should divvy it up and get it done faster.
thomas Aylott — design42 — subtleGradient — CrazyEgg
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
On Dec 7, 2006, at 10:06 AM, thomas Aylott wrote:
Ok. There are now a bunch of people that have signed on to work on this thing.
Time to start divvying up the workload.
Subversion http://projects.subtlegradient.com/tmcompletion_svn/ It's publicly viewable. request a login and password to get commit access
Basecamp http://tmcompletion.projectpath.com LOGIN anonymous PASS nopass
then, if you want access just add a message or something asking for whatever
INSTALLATION: svn co http://projects.subtlegradient.com/tmcompletion_svn/trunk/ CodeCompletion%20BETA.tmbundle/ ~/Library/Application\ Support/ TextMate/Bundles/CodeCompletion\ BETA.tmbundle
UPDATE: svn up ~/Library/Application\ Support/TextMate/Bundles/CodeCompletion \ BETA.tmbundle
Then do the TextMate menu item: Bundles > Bundle Editor > Reload Bundles
Note: there isn't anything in the bundle yet.... that's where you come in ;)
thomas Aylott — design42 — subtleGradient — CrazyEgg
On Dec 7, 2006, at 11:43 AM, thomas Aylott wrote:
Subversion http://projects.subtlegradient.com/tmcompletion_svn/ It's publicly viewable. request a login and password to get commit access
RSS SVN Log http://trippledoubleyou.subtlegradient.com/textmate/ tmcompletion_svnlog.rss
thomas Aylott — design42 — subtleGradient — CrazyEgg
Alright then.
I have some stuff done. Update you support folder and Experimental bundle. Enjoy CodeCompletion goodness.
Only have a CodeCompletions list for Ruby sofar, and that probly needs to be recreated. But the library is pretty hip.
If you want to start creating static completion lists, please do.
How to use this version Create a tmCommand, input: selection or line, output: insert as snippet, contents like this:
#!/usr/bin/env ruby require "#{ENV['TM_SUPPORT_PATH']}/lib/codecompletion" TextmateCodeCompletion.simple
By default, it'll look for a tmPreference in that bundle with the name "CodeCompletions". That preference should be like this:
{ completions = ( 'fibbity', 'flabbity', 'floo' ); }
Where the completions is an array of strings. You can overwrite that by passing in a different name for the preference like this:
TextmateCodeCompletion.simple('SomeOtherNameForMyCompletions')
Or you can use any random plist file like this:
#!/usr/bin/env ruby require "#{ENV['TM_SUPPORT_PATH']}/lib/codecompletion" choices = TextmateCompletionsPlist.new ('path_to_my_plist_file_of_doom').to_ary print TextmateCodeCompletion.new(choices,STDIN.read).to_s
Or you can just pass in an array manually like so:
#!/usr/bin/env ruby require "#{ENV['TM_SUPPORT_PATH']}/lib/codecompletion" print TextmateCodeCompletion.new([ 'fibbity', 'flabbity', 'floo' ],STDIN.read).to_s
Some goals:
Allow for objects as input with snippets as output Currently, the choices are simple an Array of strings. We will need to extend this eventually to support objects with values that are snippets. So you'll select your choice based on the key, but the calue of the key/value pair is inserted.
Speed improvements. Maybe cache the plists in ram or something.
Line only input. Currently we have to do some fancy footwork to insert the right thing in the right way since the input can either be a selection or the current line. And if you're input is a selection, then the command only replaces the selectio, so you have to make sure you don't reinsert the context and the choice_partial and stuff like that.
thomas Aylott — design42 — subtleGradient — CrazyEgg
On Dec 7, 2006, at 10:06 AM, thomas Aylott wrote:
Ok. There are now a bunch of people that have signed on to work on this thing.
Time to start divvying up the workload.
#1: First, we need a Ruby Class for the core essentials of the completion stuff. It needs to: √ Be an external library that can be called from a hundred different tmCommands X Be fully runnable from the terminal by manually passing in all the arguments (so, use the TM_* vars only as fallback) √ Get the text you're in the middle of writing √ Get the list of completions based on that text from somewhere (see #2) √ Show the menu and let you make your selection √ Return a snippet with the results
On Dec 6, 2006, at 3:41 PM, thomas Aylott wrote:
I think we should come up with a brick simple library that will let you do completions.
I've been playing around a bit with the idea. You can see me toying with a prototype script at:
http://pastie.textmate.org/26355
The code I built is at:
http://pastie.textmate.org/26356
James Edward Gray II