Skip to content
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

Navigator not updating often enough #10

Open
tweakimp opened this issue Jan 21, 2018 · 3 comments
Open

Navigator not updating often enough #10

tweakimp opened this issue Jan 21, 2018 · 3 comments

Comments

@tweakimp
Copy link
Contributor

Currently, the navigator is only updating when I go to another file or save the current file.
But when I delete a function definition for example, the function still stays in the navigator until I save.

I think it should check if there was a change or just redraw the tree more often.

I suggest this event subscription. I tried to put it in myself, but I could get it to work.

@lejsue
Copy link
Owner

lejsue commented Feb 1, 2018

Currently, I use universal-ctags to check tag/symbol when file is saved already and not check them on buffer.
But you do it! Wow! Would you mind to send the pull request?
Thanks a lot!

@tweakimp
Copy link
Contributor Author

tweakimp commented Feb 1, 2018

This is what I got so far, but I cant get it to work. Currently, once the new event happens, the tree disappears, but it is not drawn again. I dont know what is missing, maybe you can fix it.

In symbols-navigator-view.js:

populate() {
		const editor = this.getEditor();
		this.statusBarManager.setEmptySymbolLabel();
		if (editor != null) {
			let filePath = editor.getPath();
			if (filePath !== this.previousFilePath || this.refreshTag) {
				this.generateTags(filePath);
				this.refreshTag = false;
				this.currentTag = null;
			}
			this.previousFilePath = filePath;
			this.onEditorSave = editor.onDidSave((event) => {
				filePath = event.path;
				this.generateTags(filePath);
			});
			// I ADDED THIS
			this.onEditorStopChanging = editor.onDidStopChanging((event) => {
				filePath = event.path;
				this.generateTags(filePath);
			});
			this.statusBarManager.update(this.currentTag);
			this.onChangeRow = ...

and:

	removeEventForEditor() {
		if (this.onEditorSave != null) {
			this.onEditorSave.dispose();
		}
		// I ADDED THIS
		if (this.onEditorStopChanging != null) {
			this.onEditorStopChanging.dispose();
		}
		if (this.onChangeRow != null) {
			this.onChangeRow.dispose();
		}
	}

@lejsue
Copy link
Owner

lejsue commented Aug 23, 2018

Hi @tweakimp ,
Thanks for the information, I tried, and can get buffer text correctly.
But, there is one problem, I don't have any idea to solve it. That is the universal-ctags needs to input a file to parser. But, the buffer text is only string format. lol

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

No branches or pull requests

2 participants