PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, July 16, 2022

[FIXED] How to display a warning at a specific line

 July 16, 2022     hint, intellij-idea, intellij-plugin, warnings     No comments   

Issue

Quick Intellij plugin Development question.

Can somebody show me a snippet of code on how to display a warning at a specific line?

I want to display a yellow bulb and be able to alt enter.

I don't know if the yellow bulb is part of a warning or just a hint but i would very much appreciate if somebody would show me how to do it.

I tried to find it on idea plugin development but didn't have any luck

private List<PsiFile> psiFiles = new ArrayList<PsiFile>();
   public void actionPerformed(AnActionEvent e) {
   PsiManager psiManager=PsiManager.getInstance(e.getProject());
   Project project = e.getProject();
    VirtualFile srcFile;
        if(e.getProject().getBaseDir().findChild("src") == null)
            return;
        else
        {
            srcFile = e.getProject().getBaseDir().findChild("src");
        }
      //using the buildFilesList i get all the .java files
      buildFilesList(psiManager,srcFile);
     for(PsiFile file : psiFiles)
        //here i would want for a psiFile a warning to be displayed at a specific line
        System.out.println(file);

}


Solution

What you need to write is an inspection. You don't need to enumerate the files in the project; IntelliJ IDEA will take care of calling your API at the correct moment. You can find a simple example of a plugin that implements an inspection here.



Answered By - yole
Answer Checked By - Mary Flores (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing