generated from redhat-developer/new-project-template
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: associate JSON Schema for language server configuration
Signed-off-by: azerr <[email protected]>
- Loading branch information
1 parent
254cf2e
commit dff3a80
Showing
23 changed files
with
2,069 additions
and
32 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
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
51 changes: 51 additions & 0 deletions
51
...m/redhat/devtools/lsp4ij/settings/jsonSchema/AbstractLSPJsonSchemaFileSystemProvider.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,51 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 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.lsp4ij.settings.jsonSchema; | ||
|
||
import com.intellij.openapi.vfs.VfsUtil; | ||
import com.intellij.openapi.vfs.VirtualFile; | ||
import com.intellij.openapi.vfs.VirtualFileManager; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.net.URL; | ||
|
||
/** | ||
* Abstract base class for JSON schema file providers that are based on JSON schema files bundled in the plugin distribution. | ||
*/ | ||
abstract class AbstractLSPJsonSchemaFileSystemProvider extends AbstractLSPJsonSchemaFileProvider { | ||
private final String jsonSchemaPath; | ||
private VirtualFile jsonSchemaFile = null; | ||
|
||
protected AbstractLSPJsonSchemaFileSystemProvider(@NotNull String jsonSchemaPath, @NotNull String jsonFilename) { | ||
super(jsonFilename); | ||
this.jsonSchemaPath = jsonSchemaPath; | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public final VirtualFile getSchemaFile() { | ||
if (jsonSchemaFile == null) { | ||
URL jsonSchemaUrl = getClass().getResource(jsonSchemaPath); | ||
String jsonSchemaFileUrl = jsonSchemaUrl != null ? VfsUtil.convertFromUrl(jsonSchemaUrl) : null; | ||
jsonSchemaFile = jsonSchemaFileUrl != null ? VirtualFileManager.getInstance().findFileByUrl(jsonSchemaFileUrl) : null; | ||
// Make sure that the IDE is using the absolute latest version of the JSON schema | ||
if (jsonSchemaFile != null) { | ||
jsonSchemaFile.refresh(true, false); | ||
} | ||
} | ||
return jsonSchemaFile; | ||
} | ||
|
||
} |
Oops, something went wrong.