mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 06:02:11 +02:00
Cosmetics.
This commit is contained in:
parent
15c366a882
commit
b2a7ca7238
1 changed files with 9 additions and 9 deletions
|
@ -63,22 +63,22 @@ public class CContext extends TranslationUnitContext {
|
||||||
public int getStart() {
|
public int getStart() {
|
||||||
if (fIsManaged && getCompletionLength() > 0)
|
if (fIsManaged && getCompletionLength() > 0)
|
||||||
return super.getStart();
|
return super.getStart();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
IDocument document= getDocument();
|
IDocument document= getDocument();
|
||||||
|
|
||||||
int start= getCompletionOffset();
|
int start= getCompletionOffset();
|
||||||
int end= getCompletionOffset() + getCompletionLength();
|
int end= getCompletionOffset() + getCompletionLength();
|
||||||
|
|
||||||
while (start != 0 && isUnicodeIdentifierPartOrPoundSign(document.getChar(start - 1)))
|
while (start != 0 && isUnicodeIdentifierPartOrPoundSign(document.getChar(start - 1)))
|
||||||
start--;
|
start--;
|
||||||
|
|
||||||
while (start != end && Character.isWhitespace(document.getChar(start)))
|
while (start != end && Character.isWhitespace(document.getChar(start)))
|
||||||
start++;
|
start++;
|
||||||
|
|
||||||
if (start == end)
|
if (start == end)
|
||||||
start= getCompletionOffset();
|
start= getCompletionOffset();
|
||||||
|
|
||||||
return start;
|
return start;
|
||||||
} catch (BadLocationException e) {
|
} catch (BadLocationException e) {
|
||||||
return super.getStart();
|
return super.getStart();
|
||||||
|
@ -95,10 +95,10 @@ public class CContext extends TranslationUnitContext {
|
||||||
|
|
||||||
int start= getCompletionOffset();
|
int start= getCompletionOffset();
|
||||||
int end= getCompletionOffset() + getCompletionLength();
|
int end= getCompletionOffset() + getCompletionLength();
|
||||||
|
|
||||||
while (start != end && Character.isWhitespace(document.getChar(end - 1)))
|
while (start != end && Character.isWhitespace(document.getChar(end - 1)))
|
||||||
end--;
|
end--;
|
||||||
|
|
||||||
return end;
|
return end;
|
||||||
} catch (BadLocationException e) {
|
} catch (BadLocationException e) {
|
||||||
return super.getEnd();
|
return super.getEnd();
|
||||||
|
@ -109,7 +109,7 @@ public class CContext extends TranslationUnitContext {
|
||||||
public TemplateBuffer evaluate(Template template) throws BadLocationException, TemplateException {
|
public TemplateBuffer evaluate(Template template) throws BadLocationException, TemplateException {
|
||||||
if (!canEvaluate(template))
|
if (!canEvaluate(template))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
TemplateTranslator translator= new TemplateTranslator();
|
TemplateTranslator translator= new TemplateTranslator();
|
||||||
TemplateBuffer buffer= translator.translate(template.getPattern());
|
TemplateBuffer buffer= translator.translate(template.getPattern());
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ public class CContext extends TranslationUnitContext {
|
||||||
CFormatter formatter= new CFormatter(TextUtilities.getDefaultLineDelimiter(getDocument()),
|
CFormatter formatter= new CFormatter(TextUtilities.getDefaultLineDelimiter(getDocument()),
|
||||||
indentationLevel, useCodeFormatter, project);
|
indentationLevel, useCodeFormatter, project);
|
||||||
formatter.format(buffer, this);
|
formatter.format(buffer, this);
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue