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

VSCode does not have good behavior with '.properties' files when using apostrophe #19515

Closed
Tekbr opened this issue Jan 27, 2017 · 17 comments
Closed
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug
Milestone

Comments

@Tekbr
Copy link

Tekbr commented Jan 27, 2017

  • VSCode Version: 1.9.0 insider 3af0e9d
  • OS Version: Windows 10

-- Sorry for the English, I used Google Translator --

See the gif with Sublime.

teste1

See the VSCode gif. All extensions disabled.

teste5

Single quotes and double quotation marks should only autoclose if they have a space between them, if it is close to any letter (character) it should only open. See how the Sublime behaves.

@mousetraps
Copy link
Contributor

@Tekbr thanks for reporting! I'm not personally familiar with the expected grammar for *.properties files - @aeschli any ideas?

@aeschli aeschli assigned alexdima and unassigned aeschli Jan 30, 2017
@alexdima alexdima added the bug Issue identified by VS Code Team member as probable bug label Apr 27, 2017
@alexdima alexdima added this to the April 2017 milestone Apr 27, 2017
@weinand weinand added the verified Verification succeeded label Apr 27, 2017
@Tekbr
Copy link
Author

Tekbr commented Apr 27, 2017

-- Sorry for the English, I used Google Translator --

@alexandrudima @weinand @mousetraps @aeschli

Sorry for the question....

But from the code that moved, you just pulled the car shut, right?

If so, do not solve the problem.

I think @aeschli understood.

Auto close is to continue !!

The idea is (this holds for all file types):

1- If single quotes are next to a word (either at the end or beginning) it should not auto close. And should be interpreted as single quotation marks
2- If single quotes are sepadara of the word (be at the end or beginning) for a space it interprets as like quotes.
3- This is also true for double quotes, auto close if the word is separated by a space, otherwise it only

The problem I reported is that VSCode continues to enclose in quotation marks even after the line change in '.properties' (which can not happen). See on Sublime.

Any questions, ask.

@alexdima
Copy link
Member

@Tekbr there are numerous cases where the current implemented heuristic or the heuristic you suggest will fail. Simply search our issues for label editor-brackets. No heuristic will please everybody. And the only way to possibly please everybody is perhaps to have a per-language implementation and not a generic language agnostic one as we have today.

In this case, in your original issue, you have specifically mentioned .properties files. It appears for .properties files that ' (single quotes) do not hold any syntactical meaning, therefore it is not useful for them to auto-close in .properties files, as single quotes are not a syntactical error as in most other programming languages.

If you have other specific cases where the current heuristic doesn't work, please open separate issues. We can then come up with a new holistic heuristic that covers all identified unhappy cases.

@Tekbr
Copy link
Author

Tekbr commented Apr 27, 2017

@alexandrudima
But in this case the problem is not autocompletion. Do the test!! See the gifs ...

The single quotation mark remains open on the other line.

@alexdima
Copy link
Member

Aha, two for one :). You also mean the grammar is incorrect:

image

@alexdima alexdima reopened this Apr 27, 2017
@alexdima alexdima removed the verified Verification succeeded label Apr 27, 2017
@alexdima alexdima modified the milestones: Backlog, April 2017 Apr 27, 2017
@alexdima
Copy link
Member

@aeschli knows where we got the grammar from.

@alexdima alexdima assigned aeschli and unassigned alexdima Apr 27, 2017
@Tekbr
Copy link
Author

Tekbr commented Apr 27, 2017

@alexandrudima Thank you...

Please ... Revert your commit. The problem is not auto-closing.

My suggestion above, I think is related to the case that @aeschli spoke. If you do not tell me where the issue is I make the suggestion.

@alexdima
Copy link
Member

@Tekbr Why revert my commit ?

https://en.wikipedia.org/wiki/.properties states that ' is not a significant character in a .properties file. Come to think of it, maybe we should remove " too.

@Tekbr
Copy link
Author

Tekbr commented Apr 27, 2017

@alexandrudima Because Atom and Sublime work well.

That's what I said above ... the question of whether the quotation marks are at the word or not.
Eg: .properties

aspas

Eg: .html

aspas2

@alexdima
Copy link
Member

@Tekbr my change affects only .properties files so comparison with html files is unnecessary. Again, since according to wikipedia, ' (single quote) is not a syntactical element in a .properties file, it is of no help for us to auto close single quotes in .properties files. Similar how we do not auto-close ' in JavaScript comments.

@Tekbr
Copy link
Author

Tekbr commented Apr 27, 2017

@alexandrudima I do not know how to say it ... See the gifs
If ' or " is next to for it does not auto close
If ' or " is separated from the word it auto complete.

The problem here is grammar is incorrect, but the tip above applies to all files.

If the gifs do not help ... I can try to write in my language and see if anyone can translate for you, maybe Google Translator is changing the meaning.

Autocompletion helps a lot. Please revert your commit.

@aeschli
Copy link
Contributor

aeschli commented Apr 27, 2017

The grammar issue is textmate/ini.tmbundle#3

@alexdima
Copy link
Member

@Tekbr I understand quite well what you're saying, but I maintain my opinion that ' should not auto-close in .properties files, which is the change I pushed. Similar to how ' does not auto-close in a .txt file.

Please run vs code with my change and try it out, I believe there is some misunderstanding on your part to the extent of the impact of the commit, which only removes ' from .properties files. Please read closely the file the commit edits. It is the configuration file for the .properties language.

@Tekbr
Copy link
Author

Tekbr commented Apr 27, 2017

@alexandrudima I'll wait tomorrow to test!
But I manually modified your file here and it did not solve my problem. That may be the question.

How much .txt file is another problem that VSCode has.

If I open single quotation marks after word + space it's because I want to put something in quotes. If it is close to the word it is because it is apostrophe.

If it does not work, you roll back the file and reopen / move the question can you try to do something like Atom and Sublime?

@alexdima
Copy link
Member

@Tekbr They are all heuristics.

👍 I agree the heuristic you propose (to take into account a space before, not only after -- only in the case of ' or perhaps ") is perhaps better in many cases. I suggest we track this suggestion in a new issue where we start fresh without any mention of .properties files .

But be advised, as with any heuristic that is not based on syntactical or semantical analysis, it will fail. e.g. for C++ where it is desirable to auto-close ' after a word character:

https://msdn.microsoft.com/en-us/library/69ze775t.aspx
image

@Tekbr
Copy link
Author

Tekbr commented Apr 29, 2017

Please run vs code with my change and try it out, I believe there is some misunderstanding on your part to the extent of the impact of the commit, which only removes ' from .properties files.

@alexandrudima I tested .. as I had said it did not solve the reported problem.

I created Issue #25658, as suggested.

Will you reopen this case because of the problem reported from the beginning? If you do not move to the correct place (only with the initial post). I did not put it in the repository that @aeschli said because it seems to have been abandoned / forgotten (I'm not sure). I'm waiting for an answer from you.

I can also create another issue reporting this problem again, since the initial idea (shown in the first and second gif of the initial post) did not follow the purpose.

@Tekbr
Copy link
Author

Tekbr commented May 29, 2017

@alexandrudima Can you answer my question?

Will you reopen this case because of the problem reported from the beginning? If you do not move to the correct place (only with the initial post). I did not put it in the repository that @aeschli said because it seems to have been abandoned / forgotten (I'm not sure). I'm waiting for an answer from you.

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

5 participants