Railk / T3S

TypeScript plugin for Sublime Text using TSS
MIT License
224 stars 18 forks source link

Typescript plugin discussion #10

Closed seanhess closed 10 years ago

seanhess commented 11 years ago

While porting my legacy project to the latest typescript, I find frequently that I will change something, and it will continue to highlight an error even though it doesn't exist. This persists if I switch file, edit, and save the file.

In this example, note how the status says "express/node.d.ts" while the line has now been correctly changed to: "node/node.d.ts".

I don't notice anything in the sublime log.

screen shot 2013-09-05 at 2 17 48 pm

draivin commented 11 years ago

As soon as you showed that it was possible to do an asynchronous autocompleter I instantly implemented it, hahaha.

About the errors, I do believe that the TSS showErrors commands is basically compilling without the output, so it should always show the same errors that actually compilling the file would.

It is nice to be able to show all the errors together, but I don't believe it has to be a 'core' functionality, instead of a plugin command.

I tried using your build but I keep getting errors:

Traceback (most recent call last):
  File "D:\Programs\Sublime Text 3\sublime_plugin.py", line 295, in on_selection_modified_async
    callback.on_selection_modified_async(v)
  File "C:\Users\Ian\AppData\Roaming\Sublime Text 3\Packages\sublime-typescript\Typescript.py", line 673, in on_selection_modified_async
    service = projects.service(view)
  File "C:\Users\Ian\AppData\Roaming\Sublime Text 3\Packages\sublime-typescript\Typescript.py", line 37, in service
    file = project_main(view)
  File "C:\Users\Ian\AppData\Roaming\Sublime Text 3\Packages\sublime-typescript\Typescript.py", line 818, in project_main
    return view.window().project_data()["typescript_main"]
KeyError: 'typescript_main'

Edit: Also T3S has something similar to the error output in the Open Error Panel command, I believe it could be implemented a little better, but it is there!

seanhess commented 11 years ago

Sorry about that. Specify a "typescript_main": "somefile.ts" in your project settings.

On Thu, Sep 26, 2013 at 7:58 AM, Ian notifications@github.com wrote:

As soon as you showed that was possible to do an asynchronous autocompleter I instantly implemented it, hahaha.

About the errors, I do believe that the TSS showErrors commands is basically compilling without the output, so I do believe it always shows the same errors that actually compilling the file would.

It is nice to be able to show all the errors together in one place, but I don't believe it have to be a 'core' functionality, instead of a plugin command.

I tried using your build but I keep getting errors:

KeyError: 'typescript_main' Traceback (most recent call last): File "D:\Programas\Sublime Text 3\sublime_plugin.py", line 295, in on_selection_modified_async callback.on_selection_modified_async(v) File "C:\Users\Ian\AppData\Roaming\Sublime Text 3\Packages\sublime-typescript\Typescript.py", line 673, in on_selection_modified_async service = projects.service(view) File "C:\Users\Ian\AppData\Roaming\Sublime Text 3\Packages\sublime-typescript\Typescript.py", line 37, in service file = project_main(view) File "C:\Users\Ian\AppData\Roaming\Sublime Text 3\Packages\sublime-typescript\Typescript.py", line 818, in project_main return view.window().project_data()["typescript_main"] KeyError: 'typescript_main'

— Reply to this email directly or view it on GitHubhttps://github.com/Railk/T3S/issues/10#issuecomment-25169277 .

draivin commented 11 years ago
process = Popen(["/usr/local/bin/node", TSS_PATH, root_file_path], stdin=PIPE, stdout=PIPE, stderr=PIPE, **kwargs)

I'm not on linux so I had to change lines 498 and 241 and switch "/usr/local/bin/node" for "node" to make it work, the error window is coming along really nice tough.

I had one problem in that it thinks the project root folder is where the project settings file is stored, which is not my case, since I like to keep all sublime project files together . So I had to specify typescript_main in absolute path, and in the error log it also shows the path relative to the project settings file.

seanhess commented 11 years ago

Sorry about all that: you get the idea though? I think we really need something like this. It's not enough to just mark them inline. Got to see them for the whole project

On Thu, Sep 26, 2013 at 11:21 AM, Ian notifications@github.com wrote:

process = Popen(["/usr/local/bin/node", TSS_PATH, root_file_path], stdin=PIPE, stdout=PIPE, stderr=PIPE, **kwargs)

I'm not on linux so I had to change lines 498 and 241 and switch "/usr/local/bin/node" for "node" to make it work, the error window is comming along really nice tough.

I had one problem in that it thinks the project root folder is where the project settings file is stored, which is not my case, since I like to keep all sublime project files together . So I had to specify typescript_mainin absolute path, and in the error log it also shows the path relative to the project settings file.

— Reply to this email directly or view it on GitHubhttps://github.com/Railk/T3S/issues/10#issuecomment-25186215 .

draivin commented 11 years ago

I edited this on my response 4 hours ago, but there is a similar functionality in T3S, yours is better implemented but it is the same thing, in T3S you can get the error list by using the Open Error Panel command.

Edit: (Which seanhess probably won't see because e-mails) But I agree on the point that it is good to have this functionality, I just haven't got around to implementing it on my project yet, I probably will have to re-write my error handler first.

seanhess commented 11 years ago

Yeah, I wrote that :) This is V2

On Thu, Sep 26, 2013 at 12:10 PM, Ian notifications@github.com wrote:

I edited this on my response 4 hours ago, but there is a similar functionality in T3S, yours is better implemented but it is the same thing, in T3S you can get the error list by using the Open Error Panel command.

— Reply to this email directly or view it on GitHubhttps://github.com/Railk/T3S/issues/10#issuecomment-25190019 .

draivin commented 11 years ago

@seanhess Do you care if I steal your build errors syntax and color scheme?

seanhess commented 11 years ago

Please do!

On Thu, Sep 26, 2013 at 2:49 PM, Ian notifications@github.com wrote:

@seanhess https://github.com/seanhess Do you care if I steal your build errors syntax and color scheme?

— Reply to this email directly or view it on GitHubhttps://github.com/Railk/T3S/issues/10#issuecomment-25202605 .

draivin commented 11 years ago

Well, I think I'm done for today, implemented the error panel(it is triggering on save for now), and made it so that if you click on the line number in the error panel, it will take you to the error. :)

seanhess commented 11 years ago

Awesome! I think I'm going to try switching to your plugin while I work today and see how it goes.

On Thursday, September 26, 2013, Ian wrote:

Well, I think I'm done for today, implemented the error panel(it is triggering on save for now), and made it so that if you click on the line number in the error panel, it will take you to the error. :)

— Reply to this email directly or view it on GitHubhttps://github.com/Railk/T3S/issues/10#issuecomment-25211993 .

Railk commented 11 years ago

Nice panel :)

I decided not to go with create output panel but with views. Like that the layout can be arranged easily to have file outline/structure in a slim vertical view and error next to it in a larger view, with after a split view with the compile current ts file in javascript under the error view. They can be all together, or only one etc... and the typescript.tmLanguage is not bad for highlighting the errors ouput and file structure. i'll commit this new version next week since i have still some work on it but it's coming along nicely :)

I've left the socket version on the side for now, too many tss make the completions for each instance a bit slower. I'll continue with two processes and kill the unused ones (no more files open in the view).

draivin commented 11 years ago

With the latest commit I am switching to an extension based plugin, I intend to leave just the core functionality that depends on direct user interaction in the main file, like completions, and all the other functionality that can be built upon using events, like the error panel , error highlighting and stuff like that, will be self contained in the extensions folder.

For now I have migrated just the error panel to the new system, but it is really convenient to have an entire functionality self contained in a file, I'm working on the structure panel for now, and will eventually migrate the error highlighting from the core error_manager to an extension, just need to create a more robust event handler first.

seanhess commented 11 years ago

I'm ready to stop work on my plugin and start using one of yours, but during my recent week of consulting I kept switching back to mine because I really need the plugin to automatically build the project on save, and show the errors. Maybe I'll just add it to one of your plugins if I have the time ;D

@Railk is your separate view panel working? Maybe could you upload a screenshot of what you mean?

It's been fun working on this with you guys. We'll have to figure out how to merge everything over the next month or so.

On Sun, Sep 29, 2013 at 10:27 AM, Ian notifications@github.com wrote:

With the latest commit I am switching to an extension based plugin, I intend to leave just the core functionality that depends on direct user interaction in the main file, like completions, and all the other functionality that can be built upon using events, like the error panel , error highlighting and stuff like that, will be self contained in the extensions folder.

For now I have migrated just the error panel to the new system, but it is really convenient to have an entire functionality self contained in a file, I'm working on the structure panel for now, and will eventually migrate the error highlighting from the core error_manager to an extension, just need to create a more robust event handler first.

— Reply to this email directly or view it on GitHubhttps://github.com/Railk/T3S/issues/10#issuecomment-25323434 .

Railk commented 11 years ago

@seanhess to build automatically on save you can use the sublime text plugin https://github.com/alexnj/SublimeOnSaveBuild, i use it (if i remember well it works on ST3 anyway or just require small changes, i don't remember what i changed in it).

The separate view begin to work it's not finished now but should around next week-end (the screen doesn't represent the final look of the structure/errors formating):

layout

draivin commented 11 years ago

Hey Railk, I do not have the structure printed as pretty as yours yet but you can take a look at mine as I already print it as a tree!

I don't really like messing around with real views because it may disturb the workspace of people that use multiple views, so I do it with output panels, but it looks really good on your screenshots so I will probably provide a option to print in a view like yours.

Here is the structure panel: https://github.com/Draivin/subtype/blob/master/extensions/structure_panel.py

Railk commented 11 years ago

@Draivin i'll take a look :)

seanhess commented 11 years ago

That looks really good @Railk.

I think error messages are wider than tall though, as well as temporary (the output panel should auto-hide when you fix the last error to give you a sense of completeness). So I think they would probably work better in an output panel.

Can you automatically show/hide a side view like that without messing up the number of views they already have shown? (Say they have 2 views split vertically or something).

On Mon, Sep 30, 2013 at 8:28 AM, Railk notifications@github.com wrote:

@Draivin https://github.com/Draivin i'll take a look :)

— Reply to this email directly or view it on GitHubhttps://github.com/Railk/T3S/issues/10#issuecomment-25366664 .

draivin commented 11 years ago

I'm pretty much done with my structure panel, it looks a lot better now and clicking on a line takes you to the definition. Now just to add all those settings I am missing...

image

Railk commented 11 years ago

the tree structure seems really nice :) i'll try it tonight.

Railk commented 11 years ago

@seanhess the advantage of view is that after you can put them in anyway you want so if you prefer have it horizontal it's possible. For the views interaction, i think it's possible to get the current layout structure and do not mess the user choices by i need to look more into that.

Railk commented 11 years ago

I've implemented most of the things i wanted to there's still some small bug i need to correct, but i have the outline view, the error view and the build view (optionnal) + panel. And i refactored my code to have separate file and have ST2 working with the same branch.

. you can compile on save . views are read only . you can click on structure and error view to go to the corresponding place . if there's some errors during compilation it shows the error view . if structure and outline views are open there are updated on modification. (optionnal) . you can fold inside the strutcure views . the view gestion take into account the existing setup and if you kill all the "infos" views the split part is closed.

Once i correct the small bugs, i'll upload this version.

build error outline

draivin commented 11 years ago

Looking good, can't wait to see how you implemented some of that stuff!

seanhess commented 11 years ago

Good work!

On Sunday, October 6, 2013, Ian Ornelas wrote:

Looking good, can't wait to see how you implemented some of that stuff!

— Reply to this email directly or view it on GitHubhttps://github.com/Railk/T3S/issues/10#issuecomment-25773993 .

seanhess commented 11 years ago

Totally off topic, but would you guys mind taking a look at my proposal for a client-side Typescript package manager: https://github.com/seanhess/TPM

What do you think? Useful or not? What would you change?

Railk commented 11 years ago

@seanhess I'll take a look :) it seems interesting, i also saw the discution on codeplex.

I've put the new version of the plugin in the dev branch (cf. readme for changes), i tested it on osx,ubuntu and windows. There's a lot of changes so there's a possibility of bugs i didn't saw. I'll do more tests next week(-end), especially for ST2 now that there is only on branch. And then put it on the master branch.

seanhess commented 11 years ago

Great. I'm looking forward to trying it.

Did you add an error panel like subtype and mine?

On Sunday, October 13, 2013, Railk wrote:

@seanhess https://github.com/seanhess I'll take a look :) it seems interesting, i also saw the discution on codeplex.

I've put the new version of the plugin in the dev branch (cf. readme for changes), i tested it on osx,ubuntu and windows. There's a lot of changes so there's a possibility of bugs i didn't saw. I'll do more tests next week(-end), especially for ST2 now that there is only on branch. And then put it on the master branch.

— Reply to this email directly or view it on GitHubhttps://github.com/Railk/T3S/issues/10#issuecomment-26221103 .

Railk commented 11 years ago

There's an Error view, it's more flexible than the panel (you can move it, change the size etc...) i use the panel for technical messages (building info, etc...)

seanhess commented 11 years ago

How do you open it? Or I guess it's all in your documentation?

On Mon, Oct 14, 2013 at 6:21 AM, Railk notifications@github.com wrote:

There's an Error view, it's more flexible than the panel (you can move it, change the size etc...) i use the panel for technical messages (building info, etc...)

— Reply to this email directly or view it on GitHubhttps://github.com/Railk/T3S/issues/10#issuecomment-26251548 .

Railk commented 11 years ago

ctrl+shift+e it's in the dev readme.md, all the commands are listed there.