Skip to content

Commit

Permalink
fix completion filepath
Browse files Browse the repository at this point in the history
  • Loading branch information
reymondzzzz committed Dec 20, 2024
1 parent 5577ad7 commit f7a19a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion refact_lsp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
self_configure
main
Original file line number Diff line number Diff line change
Expand Up @@ -148,17 +148,16 @@ class RefactAICompletionProvider : DebouncedInlineCompletionProvider() {

override fun restartOn(event: InlineCompletionEvent): Boolean = false

private fun getActiveFile(document: Document, project: Project?): String? {
val projectPath = project?.basePath ?: return null
private fun getActiveFile(document: Document): String? {
val file = FileDocumentManager.getInstance().getFile(document) ?: return null
return Path(file.path).toUri().toString().replace(Path(projectPath).toUri().toString(), "")
return Path(file.path).toString()
}

private class Context(val request: SMCRequest, val editorState: EditorTextState, val force: Boolean = false)


private fun makeContext(request: InlineCompletionRequest): Context? {
val fileName = getActiveFile(request.document, request.editor.project) ?: return null
val fileName = getActiveFile(request.document) ?: return null
if (PrivacyService.instance.getPrivacy(FileDocumentManager.getInstance().getFile(request.document))
== Privacy.DISABLED && !InferenceGlobalContext.isSelfHosted
) return null
Expand Down

0 comments on commit f7a19a3

Please sign in to comment.