1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

Bug 278967 - Content assist on "../" results in an error

This commit is contained in:
Anton Leherbauer 2009-12-14 08:45:16 +00:00
parent a326de8cbd
commit 986dc3753a
2 changed files with 15 additions and 3 deletions

View file

@ -982,6 +982,14 @@ public class CompletionTests extends AbstractContentAssistTest {
"\"sub1/inc11.h"
};
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 {
deleteDir(tempDir);
}

View file

@ -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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -279,12 +279,16 @@ public class InclusionProposalComputer implements ICompletionProposalComputer {
} else if (prefixPath.hasTrailingSeparator()) {
namePrefix= ""; //$NON-NLS-1$
prefixPath= prefixPath.removeTrailingSeparator();
parent= parent.getFolder(prefixPath);
} else {
namePrefix= prefixPath.lastSegment();
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);
} else {
return;
}
}
if (!parent.exists()) {