Commit Graph

170 Commits

Author SHA1 Message Date
Travis Ralston
cb6f415a05 Be more positive with setting labels
Fixes https://github.com/vector-im/riot-web/issues/6435

This is done through an on-the-fly inverter for the settings. All the settings changed are boolean values, so this should be more than safe to just let happen throughout the SettingsStore. Typically a change like this would be done in the individual handlers (similar to how setting names are remapped to different properties or even different storage locations on the fly), however doing that for this many settings would be a huge nightmare and involve changing *all* the layers. By putting a global "invert this" flag on the setting, we can get away with doing the inversion as the last possible step during a read (or write).

To speed up calculations of the default values, we cache all the inverted values into a lookup table similar to how we represent the defaults already. Without this, the DefaultHandler would need to iterate the setting list and invert the values, slowing things down over time. We invert the value up front so we can keep the generic inversion logic without checking the level ahead of time. It is fully intended that a default value represents the new setting name, not the legacy name.

This commit also includes a debugger for settings because it was hard to visualize what the SettingsStore was doing during development. Some added information is included as it may be helpful for when someone has a problem with their settings and we need to debug it. Typically the debugger would be run in conjunction with `mxSendRageshake`: `mxSettingsStore.debugSetting('showJoinLeaves') && mxSendRageshake('Debugging showJoinLeaves setting')`.
2019-01-24 20:57:40 -07:00
David Baker
77efa0881e Gah, onjects 2019-01-11 14:09:29 +00:00
David Baker
fe4778b28b De-lint a few more files
& remove them from the ignored list
2019-01-11 13:54:11 +00:00
David Baker
8e4d8ccca7 Add spaces back to async arrow functions
As per https://github.com/matrix-org/matrix-js-sdk/pull/821

Requires https://github.com/matrix-org/matrix-js-sdk/pull/821
2019-01-09 18:10:35 +00:00
Aaron Raimist
49ce4ef117
eslint --fix src/
Signed-off-by: Aaron Raimist <aaron@raim.ist>
2018-10-26 22:50:38 -05:00
David Baker
9c8c84485a Fix user autocompleting
This rewrites quite a lot of QueryMatcher.
 * Remove FuzzyMatcher which was a whole file of commented out code
   that just deferred to QueryMatcher
 * Simplify & remove some cruft from QueryMatcher, eg. most of the
   KeyMap stuff was completely unused.
 * Don't rely on object iteration order, which fixes a bug where
   users whose display names were entirely numeric would always
   appear first...
 * Add options.funcs to QueryMatcher to allow for indexing by things
   other than keys on the objects
 * Use above to index users by username minus the leading '@'
 * Don't include the '@' in the query when autocomple is triggered
   by typing '@'.

Fixes https://github.com/vector-im/riot-web/issues/6782
2018-10-11 18:34:01 +01:00
David Baker
b267798010 Kill FuzzyMatcher
This has been commented out for ages. Just remove it and make things
use QueryMatcher directly rather than looking like they do fuzzy matching
but not.
2018-10-10 19:18:06 +01:00
Will Hunt
1e5101aa0c
The comment can go 2018-10-03 19:39:47 +01:00
Will Hunt
17915b5082
Merge branch 'develop' into hs/purge-irc-hack 2018-10-03 19:39:14 +01:00
Will Hunt
fe788486b7 Drop (IRC) suffix hacks 2018-10-03 19:34:06 +01:00
David Baker
a00c2b753a
Merge pull request #2085 from matrix-org/t3chguy/emoji_aliases
allow autocompleting Emoji by common aliases, e.g 👍 to 👍
2018-07-25 10:40:59 +01:00
Michael Telatynski
07f0713a56
allow autocompleting Emoji by common aliases, e.g 👍 to 👍
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-07-24 17:06:45 +01:00
Michael Telatynski
ef39327073
fix CommandMap typo
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-07-24 13:21:36 +01:00
Michael Telatynski
7c3873b449
fix @room pill href=undefined and @room parsing breaking subsequent pills
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-07-24 12:18:10 +01:00
David Baker
3c895e5a0d
Merge pull request #2074 from matrix-org/t3chguy/hide_ddg_me_after_space
hide some commands after space as they have special semantics
2018-07-19 13:51:05 +01:00
Michael Telatynski
5867fe73dd
hide some commands after space as they have special semantics
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-07-18 15:38:21 +01:00
Michael Telatynski
5b79e3bcd5
fix user autocomplete not adding : if at the start
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-07-17 11:56:24 +01:00
Michael Telatynski
8bcb987f50
delint
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-07-09 20:14:37 +01:00
Matthew Hodgson
021409aafe
apply review feedback from @lukebarnard1
(cherry picked from commit 37d4bce)
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-07-09 19:54:57 +01:00
Matthew Hodgson
efdc5430d7 merge develop 2018-07-09 17:50:07 +01:00
David Baker
7ef4377e57
Merge pull request #2007 from matrix-org/t3chguy/accent_insensitive_userprovider
accent insensitive autocomplete
2018-06-25 12:13:20 +01:00
Michael Telatynski
f21f7eff45
add word boundary to Community,Room,User provider regexps
to stop the autocompleter firing mid-word
and remove any unused capture groups

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-06-25 09:32:51 +01:00
Michael Telatynski
6a84a7ab32
apply stripDiacritics to QueryMatcher instead of individually
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-06-23 02:22:07 +01:00
Michael Telatynski
7cdc91856b
retain pre-stripped text so it can be used for rendering
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-06-23 02:12:01 +01:00
Michael Telatynski
54bccd2016
make Accent Insensitive match more generic and apply to rooms too
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-06-23 02:10:31 +01:00
Michael Telatynski
104e8d9cba
delint and add flow annotations to make my editor happy
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-06-23 02:00:36 +01:00
Michael Telatynski
ce04c745e5
strip diacritics for user autocomplete
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-06-23 01:56:24 +01:00
Michael Telatynski
9ee78de7e5
pr iteration, don't assume js-sdk stores group stuff other than groupId
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-06-22 12:05:46 +01:00
Michael Telatynski
561b9699fc
Merge branch 'develop' into t3chguy/community_autocomplete 2018-06-22 12:00:34 +01:00
Michael Telatynski
884fa3b913
use existing command hashmap over linear array search
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-06-20 17:25:23 +01:00
Michael Telatynski
7d9d17145c
change so that if someone enters invalid command with args we strict match
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-06-20 17:21:06 +01:00
Michael Telatynski
287745f8c6
delint, remove unused imports and fix flow annotations
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-06-19 12:06:13 +01:00
Michael Telatynski
b79cd205a0
Support autocompleting Communities
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-06-19 11:52:48 +01:00
Michael Telatynski
9de6bf4f5a
once command has a space, strict match instead of fuzzy match
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

(cherry picked from commit a852033)
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-06-18 19:36:11 +01:00
Michael Telatynski
107802fa29
simplify arrow func
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-06-18 19:34:46 +01:00
Michael Telatynski
85ddc0651b
consolidate the two locations commands are defined, as it was a MESS
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-06-18 19:34:40 +01:00
Michael Telatynski
a50f6094cc
allow / + wait to also show all commands
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-06-16 16:44:13 +01:00
Michael Telatynski
f152ad84b8
Improve CommandProvider for Autocomplete
improve Regexp so it leaves autocomplete up whilst typing arguments
improve completion so it doesn't discard your arguments on-hover
add a way to list all commands by using `/<TAB>`

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-06-16 16:40:44 +01:00
Matthew Hodgson
4439a04689 fix lint 2018-05-20 23:43:42 +01:00
Matthew Hodgson
9aba046f21 fix MD pill serialization 2018-05-20 14:32:20 +01:00
Matthew Hodgson
c3a6a41e5d support links in RTE 2018-05-20 00:49:29 +01:00
Matthew Hodgson
c1000a7cd5 emojioneify the composer
and also fix up the selectedness CSS for pills and emoji
2018-05-14 03:02:12 +01:00
Matthew Hodgson
e06763cd59 show all slashcommands on / 2018-05-13 03:18:41 +01:00
Matthew Hodgson
c967ecc4e5 autocomplete polishing
* suppress autocomplete when navigating through history
* only search for slashcommands if in the first block of the editor
* handle suffix returns from providers correctly
* fix SelectionRange typing in the providers
* fix bugs when pressing ctrl-a, typing and then tab to complete a replacement by collapsing selection to anchor when inserting a completion in the editor
* fix https://github.com/vector-im/riot-web/issues/4762
2018-05-13 03:04:40 +01:00
Matthew Hodgson
c91dcffe82 fix cursor behaviour around pills 2018-05-13 00:40:54 +01:00
Matthew Hodgson
9c0c806af4 correctly send pills in messages 2018-05-12 20:04:58 +01:00
Luke Barnard
a3c407992b Don't autocomplete users for single "@" 2018-04-24 13:59:18 +01:00
David Baker
8342f441df
Merge pull request #1778 from matrix-org/t3chguy/devtools_autocomplete
Add /devtools to Autocomplete and run gen-i18n
2018-03-22 09:54:26 +00:00
Michael Telatynski
9df5638c8e
make linter happy - add missing trailing comma
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-03-21 11:00:07 +00:00
David Baker
7ac583bc96
Merge pull request #1800 from ma1uta/develop
Enable autocompletion for non-English languages.
2018-03-20 10:39:20 +00:00