vmware-archive / scripted

The Scripted code editor
Eclipse Public License 1.0
1.56k stars 166 forks source link

Have some notion of content types that are independent of file extensions #147

Open aeisenberg opened 11 years ago

aeisenberg commented 11 years ago

It's becoming increasingly necessary to handle multiple file kinds with similar, but not identical functionality. For example, .json files should have the same syntax highlighting as .js files, but different content assist and error markers. .pho files should have the same syntax highlighting as html files, and should respect all content assist from html, but additionally add its own content assist. Etc.

I don't want to go too far down the rabbit hole, but having some notion of content types that specify functionality will become important as we start opening scripted to plugin developers. Eclipse uses hierarchical content types (eg- aj has a parent content type of java). I don't know if this is necessary in our case, or we can just java file extensions be registered for multiple content types if desired.

cm325 commented 11 years ago

Is it possible now to have the content assist show up automatically for other characters besides the "."?

aeisenberg commented 11 years ago

This is not something that we have implemented yet. Take a look at:

https://github.com/scripted-editor/scripted/blob/master/client/scripts/orion/editor/contentAssist.js#L204

You can change this so that content assist is invoked based on a set of pre-defined chars, or it can be configurable in th e.scripted file. I'd be willing to accept a pull request for making this configurable through .scripted.

cm325 commented 11 years ago

Are you suggesting to change this (in contentAssist,js):

/\ @private

to something that includes more than just the '.'?

On Fri, May 24, 2013 at 3:38 PM, Andrew Eisenberg notifications@github.comwrote:

This is not something that we have implemented yet. Take a look at:

https://github.com/scripted-editor/scripted/blob/master/client/scripts/orion/editor/contentAssist.js#L204

You can change this so that content assist is invoked based on a set of pre-defined chars, or it can be configurable in th e.scripted file. I'd be willing to accept a pull request for making this configurable through .scripted.

— Reply to this email directly or view it on GitHubhttps://github.com/scripted-editor/scripted/issues/147#issuecomment-18425520 .

cm325 commented 11 years ago

Wow, nice, that works great, for now, I've edited the file, adding this:

this.contentAssistRegex = new RegExp("[a-z]|[A-Z]|/.");

this.contentAssistRegex.test(e.text)

and I'll play with these settings before committing a pull request-

On Fri, May 24, 2013 at 3:45 PM, chris marx cm325@cornell.edu wrote:

Are you suggesting to change this (in contentAssist,js):

/\ @private

  • provides auto-activation for content assist on '.'

    */

    autoActivate : function(e) {

    if (e.text === '.' && !this.activationRequest) {

to something that includes more than just the '.'?

On Fri, May 24, 2013 at 3:38 PM, Andrew Eisenberg < notifications@github.com> wrote:

This is not something that we have implemented yet. Take a look at:

https://github.com/scripted-editor/scripted/blob/master/client/scripts/orion/editor/contentAssist.js#L204

You can change this so that content assist is invoked based on a set of pre-defined chars, or it can be configurable in th e.scripted file. I'd be willing to accept a pull request for making this configurable through .scripted.

— Reply to this email directly or view it on GitHubhttps://github.com/scripted-editor/scripted/issues/147#issuecomment-18425520 .

aeisenberg commented 11 years ago

There are some UI implications of opening the content assist dialog on any alpha-numeric character. For example, the up and down arrows will no longer work in the editor. Rather the dialog will steal focus. Also, not all content assist invocations are fast enough, and you may feel sluggishness as you type. I initially played around with something like this, but found these were blockers for me.

There are ways around this. But I am interested in hearing your opinion on how this kind of interaction works out for you.

On Fri, May 24, 2013 at 1:04 PM, chris marx notifications@github.comwrote:

Wow, nice, that works great, for now, I've edited the file, adding this:

this.contentAssistRegex = new RegExp("[a-z]|[A-Z]|/.");

this.contentAssistRegex.test(e.text)

and I'll play with these settings before committing a pull request-

On Fri, May 24, 2013 at 3:45 PM, chris marx cm325@cornell.edu wrote:

Are you suggesting to change this (in contentAssist,js):

/\ @private

  • provides auto-activation for content assist on '.'

*/

autoActivate : function(e) {

if (e.text === '.' && !this.activationRequest) {

to something that includes more than just the '.'?

On Fri, May 24, 2013 at 3:38 PM, Andrew Eisenberg < notifications@github.com> wrote:

This is not something that we have implemented yet. Take a look at:

https://github.com/scripted-editor/scripted/blob/master/client/scripts/orion/editor/contentAssist.js#L204

You can change this so that content assist is invoked based on a set of pre-defined chars, or it can be configurable in th e.scripted file. I'd be willing to accept a pull request for making this configurable through .scripted.

— Reply to this email directly or view it on GitHub< https://github.com/scripted-editor/scripted/issues/147#issuecomment-18425520>

.

— Reply to this email directly or view it on GitHubhttps://github.com/scripted-editor/scripted/issues/147#issuecomment-18426889 .