Merge branch 'dev' of https://github.com/continuedev/continue into dev
This commit is contained in:
commit
dae1db8ede
9 changed files with 100 additions and 37 deletions
9
.idea/continue.iml
generated
Normal file
9
.idea/continue.iml
generated
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/continue.iml" filepath="$PROJECT_DIR$/.idea/continue.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -22,7 +22,7 @@ class ConfigJsonSchemaProviderFactory : JsonSchemaProviderFactory {
|
|||
|
||||
class ConfigJsonSchemaFileProvider : JsonSchemaFileProvider {
|
||||
override fun isAvailable(file: VirtualFile): Boolean {
|
||||
return file.name == "config.json" || file.name == ".continuerc.json"
|
||||
return path.endsWith("/.continue/config.json")
|
||||
}
|
||||
|
||||
override fun getName(): String {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,49 @@
|
|||
package com.github.continuedev.continueintellijextension.`continue`
|
||||
|
||||
import com.github.continuedev.continueintellijextension.activities.ContinuePluginStartupActivity
|
||||
import com.github.continuedev.continueintellijextension.constants.getContinueGlobalPath
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.io.StreamUtil
|
||||
import com.intellij.openapi.vfs.LocalFileSystem
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.jetbrains.jsonSchema.extension.JsonSchemaFileProvider
|
||||
import com.jetbrains.jsonSchema.extension.JsonSchemaProviderFactory
|
||||
import com.jetbrains.jsonSchema.extension.SchemaType
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import java.nio.charset.StandardCharsets
|
||||
import java.nio.file.Paths
|
||||
|
||||
class ConfigRcJsonSchemaProviderFactory : JsonSchemaProviderFactory {
|
||||
override fun getProviders(project: Project): MutableList<JsonSchemaFileProvider> {
|
||||
return mutableListOf(ConfigRcJsonSchemaFileProvider())
|
||||
}
|
||||
}
|
||||
|
||||
class ConfigRcJsonSchemaFileProvider : JsonSchemaFileProvider {
|
||||
override fun isAvailable(file: VirtualFile): Boolean {
|
||||
return file.name == ".continuerc.json"
|
||||
}
|
||||
|
||||
override fun getName(): String {
|
||||
return ".continuerc.json"
|
||||
}
|
||||
|
||||
override fun getSchemaFile(): VirtualFile? {
|
||||
ContinuePluginStartupActivity::class.java.getClassLoader().getResourceAsStream("continue_rc_schema.json")
|
||||
.use { `is` ->
|
||||
if (`is` == null) {
|
||||
throw IOException("Resource not found: continue_rc_schema.json")
|
||||
}
|
||||
val content = StreamUtil.readText(`is`, StandardCharsets.UTF_8)
|
||||
val filepath = Paths.get(getContinueGlobalPath(), "continue_rc_schema.json").toString()
|
||||
File(filepath).writeText(content)
|
||||
return LocalFileSystem.getInstance().findFileByPath(filepath)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getSchemaType(): SchemaType {
|
||||
return SchemaType.embeddedSchema
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -15,6 +15,10 @@
|
|||
<ProviderFactory
|
||||
implementation="com.github.continuedev.continueintellijextension.continue.ConfigJsonSchemaProviderFactory"/>
|
||||
</extensions>
|
||||
<extensions defaultExtensionNs="JavaScript.JsonSchema">
|
||||
<ProviderFactory
|
||||
implementation="com.github.continuedev.continueintellijextension.continue.ConfigRcJsonSchemaProviderFactory"/>
|
||||
</extensions>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<editorFactoryListener
|
||||
|
|
|
|||
|
|
@ -500,7 +500,7 @@
|
|||
},
|
||||
"jsonValidation": [
|
||||
{
|
||||
"fileMatch": "config.json",
|
||||
"fileMatch": "**/.continue/config.json",
|
||||
"url": "./config_schema.json"
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ function isWin() {
|
|||
async function package(target, os, arch, exe) {
|
||||
console.log("[info] Packaging extension for target ", target);
|
||||
|
||||
// Copy config_schema.json to config.json in intellij
|
||||
// Copy config_schema to intellij
|
||||
copyConfigSchema();
|
||||
|
||||
// Install node_modules
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ const {
|
|||
execCmdSync,
|
||||
autodetectPlatformAndArch,
|
||||
} = require("../../../scripts/util/index");
|
||||
const { copyConfigSchema } = require("./utils");
|
||||
|
||||
// Clear folders that will be packaged to ensure clean slate
|
||||
rimrafSync(path.join(__dirname, "..", "bin"));
|
||||
|
|
@ -48,29 +49,8 @@ const exe = os === "win32" ? ".exe" : "";
|
|||
(async () => {
|
||||
console.log("[info] Packaging extension for target ", target);
|
||||
|
||||
// Copy config_schema.json to config.json in intellij
|
||||
fs.copyFileSync(
|
||||
"config_schema.json",
|
||||
path.join(
|
||||
"..",
|
||||
"intellij",
|
||||
"src",
|
||||
"main",
|
||||
"resources",
|
||||
"config_schema.json",
|
||||
),
|
||||
);
|
||||
// Modify and copy for .continuerc.json
|
||||
const schema = JSON.parse(fs.readFileSync("config_schema.json", "utf8"));
|
||||
schema.definitions.SerializedContinueConfig.properties.mergeBehavior = {
|
||||
type: "string",
|
||||
enum: ["merge", "overwrite"],
|
||||
default: "merge",
|
||||
title: "Merge behavior",
|
||||
markdownDescription:
|
||||
"If set to 'merge', .continuerc.json will be applied on top of config.json (arrays and objects are merged). If set to 'overwrite', then every top-level property of .continuerc.json will overwrite that property from config.json.",
|
||||
};
|
||||
fs.writeFileSync("continue_rc_schema.json", JSON.stringify(schema, null, 2));
|
||||
// Copy config schemas to intellij
|
||||
copyConfigSchema();
|
||||
|
||||
if (!process.cwd().endsWith("vscode")) {
|
||||
// This is sometimes run from root dir instead (e.g. in VS Code tasks)
|
||||
|
|
|
|||
|
|
@ -11,17 +11,6 @@ const {
|
|||
const continueDir = path.join(__dirname, "..", "..", "..");
|
||||
|
||||
function copyConfigSchema() {
|
||||
fs.copyFileSync(
|
||||
"config_schema.json",
|
||||
path.join(
|
||||
"..",
|
||||
"intellij",
|
||||
"src",
|
||||
"main",
|
||||
"resources",
|
||||
"config_schema.json",
|
||||
),
|
||||
);
|
||||
// Modify and copy for .continuerc.json
|
||||
const schema = JSON.parse(fs.readFileSync("config_schema.json", "utf8"));
|
||||
schema.definitions.SerializedContinueConfig.properties.mergeBehavior = {
|
||||
|
|
@ -33,6 +22,30 @@ function copyConfigSchema() {
|
|||
"If set to 'merge', .continuerc.json will be applied on top of config.json (arrays and objects are merged). If set to 'overwrite', then every top-level property of .continuerc.json will overwrite that property from config.json.",
|
||||
};
|
||||
fs.writeFileSync("continue_rc_schema.json", JSON.stringify(schema, null, 2));
|
||||
|
||||
// Copy config schemas to intellij
|
||||
fs.copyFileSync(
|
||||
"config_schema.json",
|
||||
path.join(
|
||||
"..",
|
||||
"intellij",
|
||||
"src",
|
||||
"main",
|
||||
"resources",
|
||||
"config_schema.json",
|
||||
),
|
||||
);
|
||||
fs.copyFileSync(
|
||||
"continue_rc_schema.json",
|
||||
path.join(
|
||||
"..",
|
||||
"intellij",
|
||||
"src",
|
||||
"main",
|
||||
"resources",
|
||||
"continue_rc_schema.json",
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
function copyTokenizers() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue