mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-04 14:13:24 +02:00
Bug 278967 - Content assist on "../" results in an error
This commit is contained in:
parent
a326de8cbd
commit
986dc3753a
2 changed files with 15 additions and 3 deletions
|
@ -982,6 +982,14 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
"\"sub1/inc11.h"
|
"\"sub1/inc11.h"
|
||||||
};
|
};
|
||||||
assertCompletionResults(fCursorOffset+=4, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS);
|
assertCompletionResults(fCursorOffset+=4, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS);
|
||||||
|
|
||||||
|
// bug 278967
|
||||||
|
getDocument().replace(fCursorOffset-5, 5, "../");
|
||||||
|
expected= new String[] {
|
||||||
|
"\"../h1/",
|
||||||
|
"\"../h2/",
|
||||||
|
};
|
||||||
|
assertCompletionResults(fCursorOffset-=2, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS);
|
||||||
} finally {
|
} finally {
|
||||||
deleteDir(tempDir);
|
deleteDir(tempDir);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2008 Wind River Systems, Inc. and others.
|
* Copyright (c) 2008, 2009 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -279,12 +279,16 @@ public class InclusionProposalComputer implements ICompletionProposalComputer {
|
||||||
} else if (prefixPath.hasTrailingSeparator()) {
|
} else if (prefixPath.hasTrailingSeparator()) {
|
||||||
namePrefix= ""; //$NON-NLS-1$
|
namePrefix= ""; //$NON-NLS-1$
|
||||||
prefixPath= prefixPath.removeTrailingSeparator();
|
prefixPath= prefixPath.removeTrailingSeparator();
|
||||||
parent= parent.getFolder(prefixPath);
|
|
||||||
} else {
|
} else {
|
||||||
namePrefix= prefixPath.lastSegment();
|
namePrefix= prefixPath.lastSegment();
|
||||||
prefixPath= prefixPath.removeLastSegments(1);
|
prefixPath= prefixPath.removeLastSegments(1);
|
||||||
if (prefixPath.segmentCount() > 0) {
|
}
|
||||||
|
if (prefixPath.segmentCount() > 0) {
|
||||||
|
IPath parentPath = parent.getFullPath().append(prefixPath);
|
||||||
|
if (parentPath.segmentCount() > 0) {
|
||||||
parent= parent.getFolder(prefixPath);
|
parent= parent.getFolder(prefixPath);
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!parent.exists()) {
|
if (!parent.exists()) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue