gpt4 book ai didi

com.intellij.xdebugger.XSourcePosition.getFile()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-24 21:25:05 31 4
gpt4 key购买 nike

本文整理了Java中com.intellij.xdebugger.XSourcePosition.getFile()方法的一些代码示例,展示了XSourcePosition.getFile()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XSourcePosition.getFile()方法的具体详情如下:
包路径:com.intellij.xdebugger.XSourcePosition
类名称:XSourcePosition
方法名:getFile

XSourcePosition.getFile介绍

暂无

代码示例

代码示例来源:origin: KronicDeth/intellij-elixir

@NotNull
public VirtualFile getFile() {
 return mySourcePosition.getFile();
}

代码示例来源:origin: go-lang-plugin-org/go-lang-idea-plugin

@Nullable
private static PsiElement findTargetElement(@NotNull Project project,
                      @NotNull XSourcePosition position,
                      @NotNull Editor editor,
                      @NotNull String name) {
 PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
 if (file == null || !file.getVirtualFile().equals(position.getFile())) return null;
 ASTNode leafElement = file.getNode().findLeafElementAt(position.getOffset());
 if (leafElement == null) return null;
 GoTopLevelDeclaration topLevel = PsiTreeUtil.getTopmostParentOfType(leafElement.getPsi(), GoTopLevelDeclaration.class);
 SyntaxTraverser<PsiElement> traverser = SyntaxTraverser.psiTraverser(topLevel)
  .filter(e -> e instanceof GoNamedElement && Comparing.equal(name, ((GoNamedElement)e).getName()));
 Iterator<PsiElement> iterator = traverser.iterator();
 return iterator.hasNext() ? iterator.next() : null;
}

代码示例来源:origin: ballerina-platform/ballerina-lang

private XBreakpoint<BallerinaBreakpointProperties> findBreakPoint(@NotNull BreakPoint breakPoint) {
  String fileName = breakPoint.getFileName();
  String packagePath = breakPoint.getPackagePath();
  String relativeFilePathInProject;
  // If the package is ".", full path of the file will be sent as the filename.
  if (".".equals(packagePath)) {
    // Then we need to get the actual filename from the path.
    int index = fileName.lastIndexOf(File.separator);
    if (index <= -1) {
      return null;
    }
    relativeFilePathInProject = fileName.substring(index);
  } else {
    // If the absolute path is not sent, we need to construct the relative file path in the project.
    relativeFilePathInProject = packagePath.replaceAll("\\.", File.separator) + File.separator + fileName;
  }
  int lineNumber = breakPoint.getLineNumber();
  for (XBreakpoint<BallerinaBreakpointProperties> breakpoint : breakpoints) {
    XSourcePosition breakpointPosition = breakpoint.getSourcePosition();
    if (breakpointPosition == null) {
      continue;
    }
    VirtualFile fileInBreakpoint = breakpointPosition.getFile();
    int line = breakpointPosition.getLine() + 1;
    if (fileInBreakpoint.getPath().endsWith(relativeFilePathInProject) && line == lineNumber) {
      return breakpoint;
    }
  }
  return null;
}

代码示例来源:origin: ballerina-platform/ballerina-lang

return;
VirtualFile file = breakpointPosition.getFile();
int line = breakpointPosition.getLine();
Project project = getSession().getProject();

代码示例来源:origin: go-lang-plugin-org/go-lang-idea-plugin

@Override
public void registerBreakpoint(@NotNull XLineBreakpoint<DlvBreakpointProperties> breakpoint) {
 XSourcePosition breakpointPosition = breakpoint.getSourcePosition();
 if (breakpointPosition == null) return;
 VirtualFile file = breakpointPosition.getFile();
 int line = breakpointPosition.getLine();
 send(new DlvRequest.CreateBreakpoint(file.getPath(), line + 1))
  .done(b -> {
   breakpoint.putUserData(ID, b.id);
   breakpoints.put(b.id, breakpoint);
   getSession().updateBreakpointPresentation(breakpoint, AllIcons.Debugger.Db_verified_breakpoint, null);
  })
  .rejected(t -> {
   String message = t == null ? null : t.getMessage();
   getSession().updateBreakpointPresentation(breakpoint, AllIcons.Debugger.Db_invalid_breakpoint, message);
  });
}

代码示例来源:origin: intellij-dlanguage/intellij-dlanguage

@Override
public void runToPosition(@NotNull XSourcePosition position, XSuspendContext context) {
  m_gdb.sendCommand(String.format("%s %s:%s", "-exec-until", position.getFile().getPath(), (position.getLine() + 1)));
}

代码示例来源:origin: GoogleCloudPlatform/google-cloud-intellij

@Nullable
private static Language getFileTypeLanguage(
  XLineBreakpoint<CloudLineBreakpointProperties> breakpoint) {
 if (breakpoint.getSourcePosition() != null) {
  FileType fileType = breakpoint.getSourcePosition().getFile().getFileType();
  if (fileType instanceof LanguageFileType) {
   return ((LanguageFileType) fileType).getLanguage();
  }
 }
 return null;
}

代码示例来源:origin: intellij-dlanguage/intellij-dlanguage

component.append(function + "():" + (sourcePosition.getLine() + 1),
      SimpleTextAttributes.REGULAR_ATTRIBUTES);
    component.append(" (" + sourcePosition.getFile().getName() + ")",
      SimpleTextAttributes.GRAY_ITALIC_ATTRIBUTES);
  } else {
    sourcePosition.getFile().getName() + ":" + (sourcePosition.getLine() + 1),
    SimpleTextAttributes.REGULAR_ATTRIBUTES);
} else {

代码示例来源:origin: Camelcade/Perl5-IDEA

@Nullable
 public static PerlLineBreakPointDescriptor createFromSourcePosition(XSourcePosition position, PerlDebugThread debugThread) {
  VirtualFile virtualFile = position.getFile();
  String virtualFilePath = virtualFile.getCanonicalPath();
  if (virtualFilePath == null) {
   return null;
  }
  String filePath = debugThread.getDebugProfileState().mapPathToRemote(virtualFilePath);
  if (filePath == null) {
   return null;
  }

  PerlLineBreakPointDescriptor descriptor = new PerlLineBreakPointDescriptor();
  descriptor.path = filePath;
  descriptor.line = position.getLine();
  return descriptor;
 }
}

代码示例来源:origin: intellij-dlanguage/intellij-dlanguage

String filePath = sourcePosition.getFile().getPath();
if (m_isWsl) {
  filePath = SdkUtil.translateWslWindowsToPosixPath(filePath);

代码示例来源:origin: GoogleCloudPlatform/google-cloud-intellij

XSourcePosition sourcePosition = mock(XSourcePosition.class);
when(sourcePosition.getLine()).thenReturn(sourceLine);
when(sourcePosition.getFile()).thenReturn(mockFile);
when(mockFile.isValid()).thenReturn(Boolean.TRUE);

代码示例来源:origin: Camelcade/Perl5-IDEA

final VirtualFile virtualFile = sourcePosition.getFile();
PsiFile psiFile = PsiManager.getInstance(project).findFile(virtualFile);

代码示例来源:origin: GoogleCloudPlatform/google-cloud-intellij

PsiFile psiFile = psiManager.findFile(ideBreakpoint.getSourcePosition().getFile());

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com