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

Fix handling of multiple completion scopes #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mkhl
Copy link

@mkhl mkhl commented Jun 4, 2015

When the YAML front matter contains no "completion-scope", the
expression [front_matter["completion-scope"]] evaluates to [nil],
which is truthy, so the rest of the chain is not evaluated and the
snippet is assigned completion_scopes of [nil].

As it happens, [nil] is serialised as <array><data>BAgw</data></array>.

When a code snippet containing that "completion scope" is present,
Xcode crashes as soon as I try to enter any text in a place where
a snippet might be admissible.

This change replaces the chain of || operators with a case
block. This leads to some ugly repetition in the resulting code,
but at least it doesn't crash Xcode. ;-)

When the YAML front matter contains no "completion-scope", the
expression `[front_matter["completion-scope"]]` evaluates to `[nil]`,
which is truthy, so the rest of the chain is not evaluated and the
snippet is assigned `completion_scopes` of `[nil]`.

As it happens, `[nil]` is serialised as `<array><data>BAgw</data></array>`.

When a code snippet containing that "completion scope" is present,
Xcode crashes as soon as I try to enter any text in a place where
a snippet might be admissible.

This change replaces the chain of `||` operators with a `case`
block.  This leads to some ugly repetition in the resulting code,
but at least it doesn't crash Xcode. ;-)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant