mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
vcs: Add a method to the VCS facade to get lines where code was removed (after that lines)
This change is needed to provide this info for run-to-cursor (see next commit) (cherry picked from commit ea7653981da641a726cfd382b5033b9aacc0e437) IJ-CR-174622 GitOrigin-RevId: 9049f1eb908b7d3cfa3d20ac2307a70e150314c9
This commit is contained in:
committed by
intellij-monorepo-bot
parent
2336e40949
commit
c6c5fd5fd0
@@ -123,6 +123,7 @@ c:com.intellij.build.output.BuildOutputInstantReaderImpl
|
||||
- a:getTitle():java.lang.String
|
||||
c:com.intellij.codeInsight.actions.VcsFacade
|
||||
- *:createPatchPreviewComponent(com.intellij.openapi.project.Project,java.util.Map):javax.swing.JComponent
|
||||
- *:getLinesWithRemovedRangesAfter(com.intellij.psi.PsiFile):java.util.List
|
||||
*:com.intellij.codeInsight.codeVision.CodeVisionProvider
|
||||
- *sf:Companion:com.intellij.codeInsight.codeVision.CodeVisionProvider$Companion
|
||||
- sf:EP_NAME:java.lang.String
|
||||
|
||||
@@ -132,6 +132,14 @@ public class VcsFacade {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the list of lines where some code (after it) was removed.
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public @NotNull List<Integer> getLinesWithRemovedRangesAfter(@NotNull PsiFile file) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify VCS that local file content has changed in a way, that IDE might not detect, and uncommitted changes should be updated.
|
||||
*
|
||||
|
||||
@@ -114,6 +114,22 @@ public final class VcsFacadeImpl extends VcsFacade {
|
||||
return getChangedRangesInfo(document, computeRanges(document, contentFromVcs));
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull List<Integer> getLinesWithRemovedRangesAfter(@NotNull PsiFile file) {
|
||||
Project project = file.getProject();
|
||||
Document document = PsiDocumentManager.getInstance(project).getDocument(file);
|
||||
if (document == null) return emptyList();
|
||||
LineStatusTracker<?> tracker = LineStatusTrackerManager.getInstance(project).getLineStatusTracker(document);
|
||||
if (tracker == null) return emptyList();
|
||||
|
||||
List<? extends Range> trackerRanges = tracker.getRanges();
|
||||
if (trackerRanges == null) return emptyList();
|
||||
return trackerRanges.stream()
|
||||
.filter(range -> range.getType() == Range.DELETED)
|
||||
.map( range -> range.getLine1())
|
||||
.toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull List<PsiFile> getChangedFilesFromDirs(@NotNull Project project,
|
||||
@NotNull List<? extends PsiDirectory> psiDirs) {
|
||||
|
||||
Reference in New Issue
Block a user