Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Can not "Associate work items" after updating to VScode 1.16 #314

Closed
ghost opened this issue Sep 11, 2017 · 45 comments
Closed

Can not "Associate work items" after updating to VScode 1.16 #314

ghost opened this issue Sep 11, 2017 · 45 comments

Comments

@ghost
Copy link

ghost commented Sep 11, 2017

After update to VS code version 1.16, it is not possible to associate the work item with the commit.
(Using Git)

@yashv
Copy link

yashv commented Sep 13, 2017

[Workaround]
Noticed that it still works if the commit 'message' is in the format: "#{task_number} - {Task Heading Text}".
Example commit message: #9999 - Fix All The Issues

@ghost
Copy link
Author

ghost commented Sep 13, 2017

Thank you. I tried it and it works fine, but only when I handwrite it into the commit textbox. In previous version(1.15), if I used "Associate work item" command and click some task, it automaticly paste the hastag with the id of task into the commit textbox. Now if I do this, nothing will happen. Could it be only some settings problem?

@antoine-duc
Copy link

Hello,

Same problem here.

@evtk
Copy link

evtk commented Sep 21, 2017

+1

was already searching why nothing happens after selecting the work item, then stumbled upon this issue :)

@chadbr
Copy link

chadbr commented Sep 28, 2017

++++++1 (lot's on team fussing at me about it...)

@dougrday
Copy link
Contributor

dougrday commented Oct 2, 2017

Any update on this? It's definitely interfering with our ability to use this extension.

@chadbr
Copy link

chadbr commented Oct 2, 2017

fwiw,

https://github.com/Microsoft/vsts-vscode/blob/955f6b03ef41fbff3f1663466fe2c4eb9215d71b/src/team-extension.ts#L373

inputBox.value is undefined... I'm not sure if this is a regression in vscode or not.

/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:29 [ms-vsts.team] Cannot read property 'value' of undefined: TypeError: Cannot read property 'value' of undefined
	at TeamExtension.appendToCheckinMessage (/Users/chadbr/.vscode/extensions/ms-vsts.team-1.122.0/out/src/team-extension.js:371:54)
	at TeamExtension.<anonymous> (/Users/chadbr/.vscode/extensions/ms-vsts.team-1.122.0/out/src/team-extension.js:362:26)
	at Generator.next (<anonymous>)
	at fulfilled (/Users/chadbr/.vscode/extensions/ms-vsts.team-1.122.0/out/src/team-extension.js:8:58)
	at <anonymous>

Type def for SourceControlInputBox

	/**
	 * Represents the input box in the Source Control viewlet.
	 */
	export interface SourceControlInputBox {

		/**
		 * Setter and getter for the contents of the input box.
		 */
		value: string;
	}

I've tried debugging the code but I can't get the extension source to load in the chrome console (I guess it's only loaded when you issue a command)

@joaomoreno
Copy link
Member

Hi guys, VS Code dev here.

There were some definite changes to the API:

	export namespace scm {

		/**
		 * ~~The [input box](#SourceControlInputBox) for the last source control
		 * created by the extension.~~
		 *
		 * @deprecated Use SourceControl.inputBox instead
		 */
		export const inputBox: SourceControlInputBox;

The scm.inputBox is now deprecated. You can start using the SourceControl.inputBox property instead.

The deprecated scm.inputBox property will stay undefined until an extension calls scm.createSourceControl, at which point it will become the SourceControl.inputBox of the SourceControl created last by your extension. The recommendation is to simply use SourceControl.inputBox from now on.

Sorry for the breakage!

@antoine-duc
Copy link

Thank you for this explanation but I'm just a final user of vsts-vscode extension.
Have you any idea when this will be fixed?

@chadbr
Copy link

chadbr commented Oct 3, 2017

The guy that made all the latest code changes hasn't been on github for a while so - I'm guessing it will be a while... @jeffyoung

@chadbr
Copy link

chadbr commented Oct 12, 2017

maybe @buckh can assign someone?

@buckh
Copy link
Member

buckh commented Oct 12, 2017

The team tells me the issue will be fixed this sprint, which means the next two weeks. Sorry this took so long.

@chriseugenerodriguez
Copy link

so tomorrow this will be fixed? update @buckh

@jrbriggs
Copy link
Member

We're going to pick this up next week.

However, if anyone wants to make a first contribution into the codebase, this is an excellent little bug to pick off and get your feet wet with! :)

@yashv
Copy link

yashv commented Oct 25, 2017

@jrbriggs, I can take it up. However, latest npm package vscode 1.1.6 still has old definitions of "interface SourceControl". it was published 2 weeks ago, so I guess its due a refresh soon.

@chadbr
Copy link

chadbr commented Oct 25, 2017

Same... I was going to fix locally but I couldn’t figure out where to find the updated typings

@yashv
Copy link

yashv commented Oct 26, 2017

TLDR; Seems like access to the inputBox of another source control extension ('git' in this case) is not available anymore.

I tried to workaround the old definitions problem by simply copying the latest from the repo. It helped initially, but then I realized that this extension does not 'create' a 'SourceControl' when the repository is a 'Git' repository.
Then I noticed that VSCode has a built-in extension for Git and that might be the default 'git - type' repository handler.
And now that the access to scm.inputBox (last input box displayed) is taken away (I believe for keeping extensions sandboxed), this extension can access the inputBox textbox only if it creates a new SourceControl type. In that case, it will be duplicating what the built-in git extension does.

I tried creating a minimal implementation (modeling after TfvcSCMProvider), and realized that the repository appeared twice in the list. I'll upload the code to my forked repo if anyone wants to take a look.

@joaomoreno
Copy link
Member

@yashv Read my details above:

The deprecated scm.inputBox property will stay undefined until an extension calls scm.createSourceControl, at which point it will become the SourceControl.inputBox of the SourceControl created last by your extension. The recommendation is to simply use SourceControl.inputBox from now on.

@yashv
Copy link

yashv commented Oct 26, 2017

@joaomoreno, I was hoping it was an easy replacement of scm.inputBox with SourceControl.inputBox.
It seems like 'inputBox' was a global variable exposed by scm namespace.

export namespace scm {
			/**
			 * ~~The [input box](#SourceControlInputBox) for the last source control
			 * created by the extension.~~
			 *
			 * @deprecated Use SourceControl.inputBox instead
			 */
			export const inputBox

Now, its tied to the instance of a SourceControl:

	export interface SourceControl {

		/**
                      ........
		 */

		/**
		 * The [input box](#SourceControlInputBox) for this source control.
		 */
		readonly inputBox: SourceControlInputBox;

Extension doesn't create any SourceControl instances when current workspace is a Git repository.
Is there a way to get access to existing SourceControl instances (not created by this extension) ?

@joaomoreno
Copy link
Member

There isn't any way currently. What is the actual feature you intend to implement?

@chriseugenerodriguez
Copy link

@joaomoreno associate work items for vsts in vs code extension, like in ticket bro. Really?

@yashv
Copy link

yashv commented Oct 27, 2017

@joaomoreno,
Bigger picture: VS online detects the commit message is same as "#{VS_task_number} - {VS_Task_Heading_Text}" and associates the commit with the task.

I'm trying to set the inputBox value text (in the format mentioned above) for the currently displayed/selected SourceControl when user clicks on a Work Item among the list displayed by this extension.

@joaomoreno
Copy link
Member

joaomoreno commented Oct 29, 2017

Would that still make sense no matter which SCM provider is active? Git? Mercurial? Perforce?

@chadbr
Copy link

chadbr commented Oct 29, 2017

I don’t see why not...

@joaomoreno
Copy link
Member

I've exported a thin API on top of the git extension, which lets you get a hold of the open repositories and their respective inputBoxes: microsoft/vscode#38389. This should be enough to close this issue.

Here's the API definition: https://github.com/Microsoft/vscode/blob/6d5112610f32429a6a6c896023af60eebee73d14/extensions/git/src/api.ts#L11:L22

Here's a sample snippet:

	const git = extensions.getExtension('vscode.git').exports;
	git.getRepositories().then(repos => {
		repos[0].inputBox.value = 'hello world'
	});

@dougrday
Copy link
Contributor

I anyone working on this fix now that @joaomoreno has provided an API? If not, I can jump in and PR it.

@chriseugenerodriguez
Copy link

@dougrday please do, no one is working on it.

@dougrday
Copy link
Contributor

dougrday commented Dec 13, 2017

@joaomoreno I think we're blocked by this issue: microsoft/vscode#31103

Here's what I'm currently seeing.

const gitExtension = vscode.extensions.getExtension('vscode.git'); // Works
const git = gitExtension.exports; // undefined

Beyond that, I think I should be querying beyond just git for other SCM providers, right? Any suggestions are definitely appreciated.

@joaomoreno
Copy link
Member

You need to test this against the latest Insider release. This change is still not in Stable.

@westerncj
Copy link

Are there any updates for this issue?

@dougrday
Copy link
Contributor

I haven't had a chance to look at it again. I'll see if I can look at it tonight.

@dougrday
Copy link
Contributor

dougrday commented Feb 7, 2018

@jrbriggs @buckh Any chance that this pull request can get reviewed & merged? I know this bug has plagued everyone for nearly 6 months now.

@kaylangan kaylangan assigned kaylangan and unassigned kaylangan Feb 7, 2018
@kaylangan
Copy link
Contributor

@dougrday we have someone on our team looking at your PR right now. Thank you for the contribution!

ermeckle added a commit that referenced this issue Feb 13, 2018
Fixed "Associate work items" command for git source control (#314)
@dougrday
Copy link
Contributor

@ermeckle Thank you for reviewing/merging!

Any word on when a new build will be pushed? Looks like there hasn't been an update in 6 months.

@ermeckle
Copy link
Contributor

I've got a couple changes of my own coming in the next week, then I'll be looking into pushing a build.

@dougrday
Copy link
Contributor

Great news, thank you!

@dougrday
Copy link
Contributor

dougrday commented Mar 12, 2018

@ermeckle Any update on a build/release?

@dougrday
Copy link
Contributor

dougrday commented Apr 4, 2018

Is this project dead...?

@kaylangan
Copy link
Contributor

@dougrday No, this project is not dead. In fact, we're in the process of releasing a new update imminently. :)

However, to set expectations, this project will not be updated as frequently as it was in the past. We project about 2-3 releases per year.

@dougrday
Copy link
Contributor

dougrday commented Apr 5, 2018

Thank you for the update. :)

Actually, 2-3 releases per year would be much better than the current schedule.

@ghost
Copy link

ghost commented Apr 27, 2018

Not being able to get the inputBox of a pre-existing source control is an absolute nightmare! Has anyone got any work arounds or is this still a major issue?

@wsyperek
Copy link

+1

@ermeckle
Copy link
Contributor

This was fixed in 1.133.0

@ghost
Copy link

ghost commented May 2, 2018

This was fixed in 1.133.0

Is there anyway to get the inputBox of a pre-existing source control?

@dougrday
Copy link
Contributor

dougrday commented May 3, 2018

Is there anyway to get the inputBox of a pre-existing source control?

See src/team-extension.ts line 375.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

14 participants