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

Features/add feature flags #12

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open

Conversation

Paril
Copy link
Collaborator

@Paril Paril commented Aug 26, 2020

This includes several parser fixes as well as the introduction of feature flags and a test of said feature flags with the a ? b : c and a ?: b operators.

joshuaskelly and others added 10 commits August 25, 2020 22:52
Add .eslintrc for my sanity
…ite number of features.

Moved `Context.language` check in 1-1 error to `Context.features.binarySubtractRequiresLeadingWhitespace`
Fix up a few things after looking around
… entail.

Fix issues where textDocument/reference would return bad symbols and cause exceptions; "null" is a valid return value for this event, so we use that now instead (-1 as line/col was invalid, too).
Push (end) token in the token list, so that "second-from-last" resolves (on missingSemicolon for instance) end up being handled.
@Paril Paril self-assigned this Aug 26, 2020
parser/quakec-parser.js Outdated Show resolved Hide resolved
parser/quakec-parser.js Outdated Show resolved Hide resolved
parser/quakec-parser.js Outdated Show resolved Hide resolved
end: { line: -1, character: -1}
}
};
return null;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes two different bugs. The language server accepts "null" as meaning "no location"; -1 causes it to throw an exception.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This happens if we are trying to get the Program for a document we don't know about. How are we getting into this case?

server/src/language.js Outdated Show resolved Hide resolved
@Paril Paril requested a review from joshuaskelly August 26, 2020 15:32
Paril added 3 commits August 26, 2020 13:56
# Conflicts:
#	parser/quakec-parser.js
#	server/src/language.js
# Conflicts:
#	parser/quakec-parser.js
#	server/src/language.js
@Paril
Copy link
Collaborator Author

Paril commented Aug 26, 2020

This branch depends on the stability branch now, so once that's ready we'll re-review this.

Copy link
Owner

@joshuaskelly joshuaskelly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking great! Requested some feedback on naming, verbiage, and other style stuff.

parser/quakec-parser.js Outdated Show resolved Hide resolved
server/src/language.js Show resolved Hide resolved
end: { line: -1, character: -1}
}
};
return null;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This happens if we are trying to get the Program for a document we don't know about. How are we getting into this case?

server/src/language.js Outdated Show resolved Hide resolved
server/src/language.js Outdated Show resolved Hide resolved
}
});

handler(Feature.supported(languageFeature));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like passing whether the feature is supported into the call back. 👍

* @param {LanguageFeatures} languageFeature
* @return {boolean}
*/
static supported(languageFeature) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both supported and unsupported probably shouldn't be used outside of Feature? Should we rename them to _supported and _unsupported? I'd like to hear your thoughts.

@@ -1444,6 +1503,7 @@ class Program {
*
* @param {Position} position
* @param {boolean} includeDeclaration
* @param {boolean} recursive
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this.

* @param {LanguageFeatures} languageFeature
* @return {boolean}
*/
static unsupported(languageFeature) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might not need this.

@@ -1022,6 +1079,7 @@ Define.symbol("[");
Define.symbol("]");
Define.symbol("$");
Define.symbol("else");
Define.symbol(":");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove.

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

Successfully merging this pull request may close these issues.

2 participants