Skip to content

Commit 025beb4

Browse files
committed
Refactor build configuration and remove CodeActionProvider; add InlineEdit functionality for enhanced user interaction
1 parent 486f4b1 commit 025beb4

File tree

3 files changed

+63
-29
lines changed

3 files changed

+63
-29
lines changed

build.sbt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,15 @@ lazy val root = project
3737
),
3838
Compile / npmDependencies ++=
3939
Seq(
40-
"@types/vscode" -> "1.96.0", //
40+
// vscode dependencies
41+
"@types/vscode" -> "1.96.0",
42+
// "@vscode/dts" -> "0.4.1", // it's just a utility to download sources
43+
"vscode-languageclient" -> "9.0.1", // working with manuallly created facade
44+
45+
// other dependencies
4146
"@types/node" -> "16.11.7", // ts 3.7
42-
"@types/node-fetch" -> "2.5.12", // ts 3.7,compile error for scalablytyped
43-
"vscode-languageclient" -> "9.0.1" // working with manuallly created facade
47+
"@types/node-fetch" -> "2.5.12" // ts 3.7,compile error for scalablytyped
48+
4449
),
4550
/* ++ // check if it is running in test
4651
(if (sys.props.get("testing") != Some("true"))

src/main/scala/vscextension/facade/CodeActionProvider.scala

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package vscextension.facade
2+
3+
import scala.scalajs.js.annotation.JSImport
4+
import scala.scalajs.js
5+
6+
import typings.vscode.mod as vscode
7+
import typings.vscode.mod.Command
8+
import scala.scalajs.js.Promise
9+
10+
/** a dialog in the editor that users can accept or reject
11+
*
12+
* part of the
13+
*
14+
* https://github.com/microsoft/vscode/blob/main/src/vscode-dts/vscode.proposed.inlineEdit.d.ts
15+
*/
16+
17+
object InlineEdit {
18+
19+
@js.native
20+
@JSImport("vscode", "InlineEdit")
21+
class InlineEdit extends js.Object {
22+
def this(text: String, range: vscode.Selection) = this()
23+
val text: String = js.native
24+
val range: vscode.Selection = js.native
25+
26+
val showRange: Range = js.native
27+
val accepted: Command = js.native
28+
val rejected: Command = js.native
29+
val shown: Command = js.native
30+
val commands: Command = js.native
31+
val action: Command = js.native
32+
}
33+
34+
@js.native
35+
trait InlineEditContext extends js.Object {
36+
val triggerKind: vscode.CodeActionTriggerKind = js.native
37+
}
38+
39+
// @js.native
40+
trait InlineEditProvider extends js.Object {
41+
def provideInlineEdits(
42+
document: vscode.TextDocument,
43+
content: InlineEditContext,
44+
token: vscode.CancellationToken
45+
): js.Promise[js.Array[InlineEdit]]
46+
}
47+
48+
@JSImport("vscode", "languages")
49+
@js.native
50+
object languages extends js.Object {
51+
def registerInlineEditProvider(selector: vscode.DocumentSelector, provider: InlineEditProvider): vscode.Disposable =
52+
js.native
53+
}
54+
55+
}

0 commit comments

Comments
 (0)