Skip to content

Commit

Permalink
fix(webview): Skip webview copying for eclipse (#5924)
Browse files Browse the repository at this point in the history
In the startup of the agent, we copy over the local webview assets into
the cody data directory. This overwrites the template files that eclipse
writes to that directory. The eclipse extension is packaged with the
webview assets it's compiled with and manages serving those resources
from it's own JAR. This change prevents any version mismatch issues that
can occur from the double copy.

Also includes a small fix for Java code generation.

## Test plan
Manually tested with Eclipse that it resolved issues loading CSS
  • Loading branch information
jamesmcnamara authored Oct 16, 2024
1 parent 181189c commit e630aa8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
7 changes: 6 additions & 1 deletion agent/src/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,12 @@ function copyExtensionRelativeResources(extensionPath: string, extensionClient:
}
}
copySources('win-ca-roots.exe')
if (extensionClient.capabilities?.webview === 'native') {
// Only copy the files if the client is using the native webview and they haven't opted
// to manage the resource files themselves.
if (
extensionClient.capabilities?.webview === 'native' &&
!extensionClient.capabilities?.webviewNativeConfig?.skipResourceRelativization
) {
copySources('webviews')
}
}
Expand Down
7 changes: 3 additions & 4 deletions agent/src/cli/scip-codegen/emitters/JavaEmitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type { Codegen } from '../Codegen'
import { Formatter, type LanguageOptions } from '../Formatter'
import type { SymbolTable } from '../SymbolTable'
import type { CodegenOptions } from '../command'
import { TypescriptKeyword } from '../utils'
import { TypescriptKeyword, capitalize } from '../utils'
import type {
DataClassOptions,
Emitter,
Expand Down Expand Up @@ -122,8 +122,7 @@ export class JavaEmitter implements Emitter {
p.line('public final class Date {}')
} else if (info.display_name === 'Null') {
p.line('public final class Null {}')
}
if (enum_) {
} else if (enum_) {
this.emitEnum(p, enum_)
} else {
p.line(`public final class ${name} {} // TODO: fixme`)
Expand Down Expand Up @@ -260,7 +259,7 @@ export class JavaEmitter implements Emitter {
}

getFileNameForType(tpe: string): string {
return `${tpe}.${this.getFileType()}`
return `${capitalize(tpe)}.${this.getFileType()}`
}

getFileType(): string {
Expand Down

0 comments on commit e630aa8

Please sign in to comment.