-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(view, vscode): implement branchSelector onChange handler #486
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
드디어 이게 되는군요 :)
전체적으로 코드가 깔끔해져서 좋습니다.
추가로 comment달았는데, 추후에 반영 혹은 논의 부탁드리겠습니다~.
const ideAdapter = container.resolve<IDEPort>("IDEAdapter"); | ||
setLoading(true); | ||
ideAdapter.sendFetchAnalyzedDataMessage(e.target.value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
지난번 refactoring 수행하면서 services/index.ts에 필요 api들을 모아두었습니다.
(바로 ideAdapter를 안 쓰고 한번 더 wrapping 했어요)
참고해주시고, 이번 or 다음 PR에서 수정 부탁드립니다~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오 넵넵 BranchSelector, RefreshButton에 적용해두겠습니다~
baseBranch: string; | ||
setBaseBranch: Dispatch<SetStateAction<string>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
base
라고 해야할지, selected
라고 하는게 맞을지, current
라고 해야 할지 좀 헷갈리긴 하네요 ㅎㅎ
한번 고민해보면 좋겠습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저도 3가지 중에서 고민을 했었다가 base branch를 추후 vscode에서 fetching 해오는 작업이 있을까 해서, baseBranch로 두었는데view에서는 selected로 두는게 직관적인것 같네요...!
이렇게 용어를 정리하면 될 것 같네요...🤔
view
: selected branch (BranchSelector Component에서 선택한 값, 초기 값은 git HEAD의 위치)
vscode
: selected(view에서 전달받은 값) branch or current branch (git branch --show-current)
engine
: base branch (stem target base branch)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오. 완전 좋습니다!
packages/vscode/src/extension.ts
Outdated
const fetchBranches = async () => await getBranches(gitPath, currentWorkspacePath); | ||
const fetchCurrentBranch = async () => await getCurrentBranchName(gitPath, currentWorkspacePath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refactoring으로 깔끔해졌네요!! 👍👍👍👍👍
export function getDefaultBranchName(branchList: string[]): string { | ||
const branchSet = new Set(branchList); | ||
return branchSet.has("main") ? "main" : branchSet.has("master") ? "master" : branchList?.[0]; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 method는 언제 쓰이나요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
예전에 base branch 불러올때 해당 함수를 썼었는데 이제 git branch --show-current
를 대상으로 하는 방식(#477 (comment)) 으로 바꾸면서 현재는 사용하지 않고 있긴 합니다. 삭제하도록 하겠습니다~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
detached branch 상황에 대응하여 사용하는걸로 바꿨습니다. 기록용으로 코멘트 남깁니다 :)
@@ -107,3 +108,10 @@ export default class WebviewLoader implements vscode.Disposable { | |||
return returnString; | |||
} | |||
} | |||
|
|||
type GithruFetcher<D = unknown, P extends unknown[] = []> = (...params: P) => Promise<D>; | |||
type GithruFetcherMap = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(naming) Map
보다는 명시적인게 더 좋을 것 같긴 합니다.
Githru
는 빼도 괜찮을 것 같구요.
(react의 prop 같은 녀석이라고 생각해도 될 것 같고...)
혹은 extension.ts에서 fetcher들의 dependency를 없애고 아예
webview-loader쪽으로 가져와도 괜찮을 것 같습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
그냥 dependecy를 없애는게 장기적으로 좋을 것 같네요! 말씀하신 부분은 다음 PR로 끊어서 진행하겠습니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!!!
closed: #276 |
Related issue
Result
Work list
git branch --show-current
결과 값 returnDiscussion
Note
추가적인 .git 디렉토리 관련 파일의 추가/변경에 대한 추적 필요성? https://vshaxe.github.io/vscode-extern/vscode/FileSystemWatcher.html