Closed DartBot closed 9 years ago
Added Area-Editor, Triaged labels.
Set owner to @scheglov. Removed Priority-Unassigned label. Added Priority-Medium label.
I have no plans fixing it. It's not quite a bug - it is correct from the point of just text editing, it is a missing feature.
Would you contribute a patch to these files?
dart/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/dart/DartAutoIndentStrategy.java - see smartPaste(). dart/editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/internal/text/dart/DartAutoIndentStrategyTest.java
Removed Type-Defect label. Added Type-Enhancement, NotPlanned labels.
This comment was originally written by @mezoni
I have no plans fixing it. It's not quite a bug - it is correct from the point of just text editing, it is a missing feature.
I agree with you (it is not only correct...). Only very ugliest in the world IDE such as Visual Studio and Jetbrains Idea does not have such NOT_A_BUG (very correct behavior). Dart Editor in no way should not repeat their errors (to be most popular in the world). Otherwise it would deprive him of a unique personality.
Thank you very much for your uniqueness and identity. From me personally and from the sellers of the above mentioned commercial products.
P.S.
More to have such self-taught as you and the Dart Editor starts winning in all rankings of the most useless things.
This comment was originally written by andrew.m...@gmail.com
Oh my, very ugliest Eclipse does not have such "a missing feature" from the point of just text editing.
I go to trying Notepad++..
If you care about the future of Editor - as I said earlier, patches are welcome.
This comment was originally written by andrew.m...@gmail.com
What I do wrong? I cannot reproduce this "missing feature" even in Notepad++. I think I should write to their suppory about that the they should such "missing feature".
A they say "Ig nobel prize"...
This comment was originally written by andrew.m...@gmail.com
If you care about the future of Editor - as I said earlier, patches are welcome.
I just want to use it (as and many people). But this does not means that I should create the patches (without pay) for commercial company such as Google.
Editor (and Dart in general) is an open source project. Everyone is able to benefit from it, not just the company that puts the most of engineers. You would help not Google, but the Dart community.
This comment was originally written by andrew.m...@gmail.com
Look at this code: This is my little "NOW HOW". But your "smart indet" is "a big piece of shit".
++++++++++++++++ static List<String> codeToStrings(String code) { if (code == null || code.isEmpty) { return []; }
//code = code.trimRight(); var end = code.length - 1; for ( ; end >= 0; end--) { if (code.codeUnitAt(end) != 32) { break; } }
code = code.substring(0, end + 1); code = code.replaceAll('\r\n', '\n'); code = code.replaceAll('\r', '\n'); code = code.replaceAll('\t', ' '); var lines = code.split('\n'); var strings = []; if (lines.length == 1) { var line = lines[0]; var length = line.length; var pos = 0; for (var i = 0; i < length; i++) { if (line[i] == ' ') { pos++; } else { break; } }
line = line.substring(pos); strings.add(line); return strings; }
var indent = 0; var second = lines[1]; var length = second.length; for (var i = 0; i < length; i++) { if (second[i] == ' ') { indent++; } else { break; } }
var numOfLines = lines.length; for (var i = 0; i < numOfLines; i++) { var string = lines[i]; if (i == 0 || i == numOfLines - 1) { var length = string.length; var empty = true; for (var i = 0; i < length; i++) { if (string[i] != ' ') { empty = false; break; } }
if (empty) { continue; } }
var count = 0; var length = string.length; for (var i = 0; i < indent && i < length; i++, count++) { if (string[i] != ' ') { break; } }
strings.add(string.substring(count)); }
return strings; } ++++++++++++++++
What it does? It does not know anything about the Dart grammar but it correctly adust an indents.
Examples:
++++++++++++++++
A <- 'a' { $$ = "Hello"; }
++++++++++++++++
Generates:
if (success) {
final $1 = $$;
$$ = "Hello";
}
++++++++++++++++
A <- 'a' { $$ = "Hello"; }
++++++++++++++++
Generates:
if (success) {
final $1 = $$;
$$ = "Hello";
}
++++++++++++++++
A <- 'a' { var x = "Hello"; $$ = x; }
++++++++++++++++
Generates:
if (success) {
final $1 = $$;
var x = "Hello";
$$ = x;
}
++++++++++++++++ A <- 'a' { var x = "Hello"; $$ = x; }
++++++++++++++++
Generates:
if (success) { final $1 = $$; var x = "Hello"; $$ = x; }
++++++++++++++++
A <- 'a' { var x = "Hello"; $$ = x; }
++++++++++++++++
Generates:
if (success) {
final $1 = $$;
var x = "Hello";
$$ = x;
}
Template is very primitive. So all logic in codegen.
if ($_SUCCESS) {
{{#VARIABLES}}
{{#CODE}}
}''';
This comment was originally written by andrew.m...@gmail.com
All "code" between "{" and "}" are the same as "code to paste into" action. It correctly adjusted to above goign code.
Eg. // Was // Was // Added
// Was // Was // Added
++++++++++++ A <- 'a' { var x = "Hello"; $$ = x; } ^ ^^^^^ ^^^^^^^^^^^^^^^^^^^^^
if (success) { // <= WAS from template final $1 = $$; // <= Added var x = "Hello";// <= Added $$ = x; // <= Added } // <= WAS from template
In your Editor this will be as the following
if (success) { // <= WAS from template final $1 = $$; // <= Added var x = "Hello";// <= Added $$ = x; // <= Added } // <= WAS from template
P.S.
Very ugly...
This comment was originally written by andrew.m...@gmail.com
if ($_SUCCESS) {
{{#VARIABLES}}
{{#CODE}}
}''';
if ($_SUCCESS) {
{{#VARIABLES}}
{{#CODE}}
^^ <==== Only this fixed
}''';
Some comment. Nothing prevent to make it adjustable to previous indent.
Eg.
// 6 spaces indent we know this ^^^^^^ Here we paste text
// 6 spaces indent we know this ^^^^^^ We know about 6 spaces indent => All text inserted here adujsted by smart indent <=
I not quite understand all this code you posting here. An actual patch for the mentioned earlier Java files would be much more useful :-)
This comment was originally written by andrew.m...@gmail.com
You would help not Google, but the Dart community. That's a lie. Google is a commercial organization. And that's true.
If I want help a Dart community I wrote my own software.
This comment was originally written by andrew.m...@gmail.com
I not quite understand all this code you posting here.
It adujst indents.
Eg. this bug is not possible with my code.
// Comment #1 // Comment #2 // Comment #1
It adust third line "// Comment #1" to previous "// Comment #2". But your code cannot.
Also my code correctly indents all "pasted" lines.
P.S.
I not quite understand all this code you posting here.
I already undestand this. This is your problem and this is a problem of Dart Editor users...
This comment was originally written by andrew.m...@gmail.com
I not quite understand all this code you posting here.
This examples from parser genarator.
This parser generator glues pieces of text (as and in your Editor). When I paste some pieces of text into other text I want it should be very well positioned. An indentation should be calculated and correctly applied to all piece of the glued text (according to the choosed location where this piece of text should be placed "glued").
Your algorithm has some errors. It work not correctly. Why you call this error as "missing feature"?
This issue was originally filed by andrew.m...@gmail.com
Steps:
1 Enter this text
============== // Comment #1 // Comment #2 ==============
2 Hit <Enter> after comment #2
============== // Comment #1 // Comment #2
==============
3 Select comment #1
============== // Comment #1 ^^^^^^^^^^^^^ ==============
4 Copy selected text
5 Move cursor as pointed below
============== // Comment #1 // Comment #2 ^ ==============
6 Paste copied text
7 See on bug
============== // Comment #1 // Comment #2 // Comment #1 ==============
8 Should be
============== // Comment #1 // Comment #2 // Comment #1 ==============
Result #8 I can see even here when paste it on this tracker in HTML Editor.
I don't think the Dart Editor are more primitive than HTML Editor on this trackers.
Please, fix this very very very OLDEST bug.