-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Fred Bricon <[email protected]>
- Loading branch information
Showing
16 changed files
with
487 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...va/com/redhat/devtools/intellij/qute/psi/core/inspections/AbstractDelegateInspection.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Red Hat Inc. and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
* which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
* | ||
* Contributors: | ||
* Red Hat Inc. - initial API and implementation | ||
*******************************************************************************/ | ||
package com.redhat.devtools.intellij.qute.psi.core.inspections; | ||
|
||
import com.intellij.codeInspection.LocalInspectionTool; | ||
|
||
/** | ||
* No-op {@link LocalInspectionTool} used as a basis for mapping inspection severities to matching LSP severities. | ||
*/ | ||
public abstract class AbstractDelegateInspection extends LocalInspectionTool { | ||
} |
21 changes: 21 additions & 0 deletions
21
.../redhat/devtools/intellij/qute/psi/core/inspections/QuteUndefinedNamespaceInspection.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Red Hat Inc. and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
* which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
* | ||
* Contributors: | ||
* Red Hat Inc. - initial API and implementation | ||
*******************************************************************************/ | ||
package com.redhat.devtools.intellij.qute.psi.core.inspections; | ||
|
||
/** | ||
* Dummy inspection for undefined namespaces in Qute templates | ||
*/ | ||
public class QuteUndefinedNamespaceInspection extends AbstractDelegateInspection { | ||
public static final String ID = getShortName(QuteUndefinedNamespaceInspection.class.getSimpleName()); | ||
} |
21 changes: 21 additions & 0 deletions
21
...com/redhat/devtools/intellij/qute/psi/core/inspections/QuteUndefinedObjectInspection.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Red Hat Inc. and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
* which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
* | ||
* Contributors: | ||
* Red Hat Inc. - initial API and implementation | ||
*******************************************************************************/ | ||
package com.redhat.devtools.intellij.qute.psi.core.inspections; | ||
|
||
/** | ||
* Dummy inspection for undefined objects in Qute templates | ||
*/ | ||
public class QuteUndefinedObjectInspection extends AbstractDelegateInspection { | ||
public static final String ID = getShortName(QuteUndefinedObjectInspection.class.getSimpleName()); | ||
} |
46 changes: 46 additions & 0 deletions
46
src/main/java/com/redhat/devtools/intellij/qute/settings/ProblemSeverity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Red Hat Inc. and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
* which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
* | ||
* Contributors: | ||
* Red Hat Inc. - initial API and implementation | ||
*******************************************************************************/ | ||
package com.redhat.devtools.intellij.qute.settings; | ||
|
||
import com.intellij.lang.annotation.HighlightSeverity; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
/** | ||
* Problem severity levels used by Qute LS | ||
*/ | ||
//TODO move to lsp4ij? | ||
public enum ProblemSeverity { | ||
none, warning, error; | ||
|
||
/** | ||
* Maps {@link HighlightSeverity} to {@link ProblemSeverity} levels used by LSP4MP. | ||
* <ul> | ||
* <li>Any severity below <code>HighlightSeverity.WEAK_WARNING</code> is mapped to <code>ProblemSeverity.none</code></li> | ||
* <li>Any severity below <code>HighlightSeverity.ERROR</code> is mapped to <code>ProblemSeverity.warning</code></li> | ||
* <li>Any other severity is mapped to <code>ProblemSeverity.error</code></li> | ||
* </ul> | ||
* | ||
* @param highlightSeverity the severity to map to a {@link ProblemSeverity} | ||
* @return the matching {@link ProblemSeverity} | ||
*/ | ||
public static @NotNull ProblemSeverity getSeverity(@NotNull HighlightSeverity highlightSeverity) { | ||
if (HighlightSeverity.WEAK_WARNING.compareTo(highlightSeverity) > 0) { | ||
return none; | ||
} | ||
if (HighlightSeverity.ERROR.compareTo(highlightSeverity) > 0) { | ||
return warning; | ||
} | ||
return error; | ||
} | ||
} |
Oops, something went wrong.