Forums

Editor

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

Re: Editor

Postby torial » Fri Jul 01, 2011 12:37 pm

suliman wrote:I would like to see editor like this:
Image
IMHO very nice view.

http://mirelle.codeplex.com/releases/view/62887


Out of curiosity, what does "like this" mean?
a) Barebones, few features, just builds the source files?
b) Has an error window, text editor, build control?
c) Something else?
torial
 
Posts: 227
Location: IA

Re: Editor

Postby Charles » Fri Jul 01, 2011 7:16 pm

While we're discussing, I've always thought it would be interesting if error messages were integrated with the source code such that a separate window would not be necessary. This also removes the need to move your eyeballs back and forth from the error window to the source code.

One approach could be to enhance the Cobra compiler to add errors and warnings to the source files as comments:

def foo
.
.
x = y
# error: Cannot find "y". (1 of 2)
.
.


For this to be effective the editor would need to:
-- auto-reloads files
-- provides keyboard shortcuts to go to the next and previous message
-- possibly provide toolbar icons for the same purpose
-- automatically jump to the first message after a build

Another command to remove the comments might be necessary, for example, if there were some warnings that you didn't want to check into source code control (although it might not hurt to leave such messages in).

Of course, on the next build, Cobra would remove comments matching patterns like "# error: ... (x of y)" and then add new ones if necessary.

I think I would enjoy this more than the traditional error box approach.
Charles
 
Posts: 2508
Location: Los Angeles, CA

Re: Editor

Postby RIGHT_THEN » Fri Jul 01, 2011 11:29 pm

i think this approach is implemented in Monodevelop for C#
but ofcourse they are not comments but small windows.

Thanking_You
RIGHT_THEN
RIGHT_THEN
 
Posts: 99

Re: Editor

Postby Charles » Sat Jul 02, 2011 1:44 am

The comments would be interesting because it could be leveraged by anyone's editor or IDE provided they could get autoloading going.
Charles
 
Posts: 2508
Location: Los Angeles, CA

Re: Editor

Postby RIGHT_THEN » Sat Jul 02, 2011 8:02 am

hey Charles

As far as SD,VS,Monodevelop and Notepad++ are concerned autoloading is there by default.
i think various editors in linux also might be having this feature. actually all system editors and
established editors have it they all usually say "file has been changed do you want to reload".
To remove the anoyance of DialogBoxes asking permission. eitheruser would have to uncheck
"Ask everytime" or creator of plugin would have to automate this feature.
otherwise as many files that many dialog boxes everytime.

this would also effect the next compile cycle especially for the warnings because they
are usually more than errors.writing and deleting them would take time if not much time.
it might show its effects in large projects. So it would be good
to be able to turn off this feature on file by file basis or for the project as a whole.

it might bring up a challenge for intellisense engine also. because as soon as errors are
placed within the file. Go to Definations would have to be recalculated because line number
if not column number for many things below error messages will change.
( but that it would have to do for every new word written so it is a minor..)

therefore

if at all you want to do this then how about creating the temp file for it say,
Cobra1.cobra file produces some compiler messages now instead of writing it
in the Cobra1.cobra file Write it to new file Cobra1.cobra.errors which in turn should
be shown in the editor.
so in the next compile cycle you dont have to delete messages from original file
but simply discard it. or leave it as it is. if again error happens in
the same file this .errors file can be overwritten. now the user can be smart enough
to make changes accordingly in the original file. but that might appear to some and you
as uninviting as error messages in other window in the first place. So it is your decision.

but it is a good thought of yours. to give the message where it ought to be.

or one more thing could be done compiler need not rewrite the file on every compile cycle.
to remove those messages. it can merely do this "# error: message...\n..." when it occurs
and if user corrects it. compile could insert "_corrected" shown below this for its own reference
as to what it needs to remove in future and for user to also know if he has performed correct action
"#error_corrected : message...\n....". now compiler can check number of messages it has to delete if they
wont effect compile time then it should delete immidiatly or it can delete them gradually at every next compile or
delete them all after few compiles. it would become/act kind of GC collecting unrequired errors/warnings/messages.

you know what Charles put a switch in compiler -intellisense:on|off so that intellisense
can be built into the compiler itself. that is, suppose if user writes System.Console. and then
compiles, all available items can be shown just as you are about to show errors.
# available items:
# write(signature)
# writeLine(signature)


so now in Ides two compilers can be running all the time one for compiling normally and other would
keep producing such messages as the user types. but this time in pop up windows. but if user is not
in a IDE than even he can get the useful info just like errors. i think these features would be very unique to
cobra. i dont know of any other language that has it. unless you want to tell..

but again problem would be that some Classes or namspaces have many items that would just clutter the
file.

Thanking_You
RIGHT_THEN
RIGHT_THEN
 
Posts: 99

Re: Editor

Postby Charles » Sat Jul 02, 2011 1:13 pm

Yes, most editors have some kind of detection of changed files, but as you pointed out, some of them always ask about it, and some of those have no option to do it automatically.

Yes, "Go to definitions" needs adjustment to any cached information any time a file is loaded.

I don't see how putting the errors in Foo.cobra.errors will help much since that file wouldn't be automatically loaded (in existing editors as they are now) and even if it was, you'd be tempted to fix the problems there, but you would be editing the wrong file. Unless I'm just missing your point.

I guess some of your concerns here revolve around whether it would be taxing to the compiler and/or IDE regarding the rewriting and reloading of files, but typically I only have a few errors in 1 - 3 files. It shouldn't be a problem.

I think the -intellisense option is a good idea. That's a trademark of Microsoft, so we'd have to call it -autocompletion. Also, there are external APIs for this sort of thing, such as http://code.google.com/p/pysmell/ which supports Vim, Emacs and TextMate. I was already planning on providing similar support at some point.

I'm still working on @help though which provides similar benefits. I want to finish that off first.
Charles
 
Posts: 2508
Location: Los Angeles, CA

Re: Editor

Postby RIGHT_THEN » Sun Jul 03, 2011 8:25 am

Charles wrote:but typically I only have a few errors in 1 - 3 files. It shouldn't be a problem.


What about me :cry:

Thanking_You
RIGHT_THEN
RIGHT_THEN
 
Posts: 99

Re: Editor

Postby Charles » Sun Jul 03, 2011 8:50 am

If you're being serious: If you have more than a few errors in a few files, you may not be compiling often enough. And you may need to break you work into smaller, more manageable chunks.

But maybe you were joking. :D
Charles
 
Posts: 2508
Location: Los Angeles, CA

Re: Editor

Postby torial » Mon Jul 04, 2011 10:07 am

Charles,

This is a bit alien a thought to me... so some questions to explore....

a) What is the primary value of adding it directly into the text?
b) Do you wish for warnings to be there as well?
c) I sometimes use compiler errors to aid in refactoring -- what would be the advantage of having that text inserted in? Find / Find next?
d) How would you envision the fixing of compilation and warning messages to work?

All for now.
torial
 
Posts: 227
Location: IA

Re: Editor

Postby Charles » Mon Jul 04, 2011 1:32 pm

torial wrote:Charles,

This is a bit alien a thought to me... so some questions to explore....

a) What is the primary value of adding it directly into the text?

I find it annoying in IDEs such as Visual Studio that:
1. The error panel pops up and obscures my editor window.
2. I have to constantly go back and forth between two different parts of the screen.
I would prefer instead that the errors and warnings be co-located with no change in my window/panel arrangement.
b) Do you wish for warnings to be there as well?

Yes, for the same reasons.
c) I sometimes use compiler errors to aid in refactoring -- what would be the advantage of having that text inserted in? Find / Find next?

I do the same thing. Any advantages are listed in my answer to a)
d) How would you envision the fixing of compilation and warning messages to work?

You would fix them like you normally would. Then on your next build, they would be removed and possibly new ones added.

Additional thoughts:

-- I haven't done this before, so there's no guarantee it will work in practice. I would certainly like to try it though.

-- An editor/IDE could do this even without Cobra's support since it has control over the display.
Charles
 
Posts: 2508
Location: Los Angeles, CA

PreviousNext

Return to Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron