Skip to content

Commit

Permalink
fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
antico5 committed Nov 11, 2023
1 parent fcd61ba commit c93765e
Show file tree
Hide file tree
Showing 17 changed files with 49 additions and 58 deletions.
20 changes: 10 additions & 10 deletions client/scripts/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,16 +200,16 @@ async function main() {
"@nomicfoundation/solidity-analyzer-linux-x64-musl": "0.1.1",
"@nomicfoundation/solidity-analyzer-freebsd-x64": "0.1.1",

"@nomicfoundation/slang": "0.4.0",
"@nomicfoundation/slang-darwin-arm64": "0.4.0",
"@nomicfoundation/slang-win32-arm64-msvc": "0.4.0",
"@nomicfoundation/slang-linux-arm64-gnu": "0.4.0",
"@nomicfoundation/slang-linux-arm64-musl": "0.4.0",
"@nomicfoundation/slang-win32-ia32-msvc": "0.4.0",
"@nomicfoundation/slang-darwin-x64": "0.4.0",
"@nomicfoundation/slang-win32-x64-msvc": "0.4.0",
"@nomicfoundation/slang-linux-x64-gnu": "0.4.0",
"@nomicfoundation/slang-linux-x64-musl": "0.4.0",
"@nomicfoundation/slang": "0.10.1",
"@nomicfoundation/slang-darwin-arm64": "0.10.1",
"@nomicfoundation/slang-win32-arm64-msvc": "0.10.1",
"@nomicfoundation/slang-linux-arm64-gnu": "0.10.1",
"@nomicfoundation/slang-linux-arm64-musl": "0.10.1",
"@nomicfoundation/slang-win32-ia32-msvc": "0.10.1",
"@nomicfoundation/slang-darwin-x64": "0.10.1",
"@nomicfoundation/slang-win32-x64-msvc": "0.10.1",
"@nomicfoundation/slang-linux-x64-gnu": "0.10.1",
"@nomicfoundation/slang-linux-x64-musl": "0.10.1",
},
})
);
Expand Down
1 change: 0 additions & 1 deletion server/src/services/documentSymbol/SymbolVisitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export abstract class SymbolVisitor {
public abstract ruleKind: RuleKind;
public abstract symbolKind: SymbolKind;
public abstract nameTokenKind: TokenKind;
public nameTokenSkips = 0;

constructor(
public document: TextDocument,
Expand Down
9 changes: 0 additions & 9 deletions server/src/services/documentSymbol/onDocumentSymbol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,6 @@ export function onDocumentSymbol(serverState: ServerState) {
throw new Error(`Slang parsing error: ${strings.join("")}`);
}

// const kursor: Cursor = parseTree.cursor.clone();
// do {
// console.log(
// `${" ".repeat(kursor.pathRuleNodes.length)}${kursor.node.kind}(${
// ["R", "T"][kursor.node.type]
// }): ${kursor.node?.text ?? ""}`
// );
// } while (kursor.goToNext());

const builder = new SymbolTreeBuilder();

const visitors: SymbolVisitor[] = [
Expand Down
5 changes: 5 additions & 0 deletions server/src/services/initialization/featureFlags.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import got from "got";
import crypto from "crypto";
import { ServerState } from "../../types";
import { isTestMode } from "../../utils";

export interface FeatureFlag {
percent: number;
Expand Down Expand Up @@ -57,6 +58,10 @@ export function isFeatureEnabled(
throw new Error(`Feature flag not found: ${feature}`);
}

if (isTestMode()) {
return true;
}

// hash the machineId to get an evenly distributed value
const machineIdHash = crypto.createHash("md5");
machineIdHash.update(machineId);
Expand Down
37 changes: 23 additions & 14 deletions server/src/services/initialization/onInitialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,21 @@ export const onInitialize = (serverState: ServerState) => {

logger.info("Language server ready");

const slangSupported = isSlangSupported();

const semanticTokensEnabled = isFeatureEnabled(
serverState,
flags,
"semanticHighlighting",
machineId
);

const documentSymbolsEnabled = isFeatureEnabled(
serverState,
flags,
"documentSymbol",
machineId
);
// Index and analysis
await serverState.telemetry.trackTiming(
"indexing",
Expand All @@ -65,11 +80,14 @@ export const onInitialize = (serverState: ServerState) => {

return { status: "ok", result: null };
},
{ platform: getPlatform() }
{
platform: getPlatform(),
slangSupported,
semanticTokensEnabled,
documentSymbolsEnabled,
}
);

const slangSupported = isSlangSupported();

// Build and return InitializeResult
const result: InitializeResult = {
serverInfo: {
Expand Down Expand Up @@ -98,18 +116,9 @@ export const onInitialize = (serverState: ServerState) => {
tokenModifiers: [],
},
range: false,
full:
slangSupported &&
isFeatureEnabled(
serverState,
flags,
"semanticHighlighting",
machineId
),
full: slangSupported && semanticTokensEnabled,
},
documentSymbolProvider:
slangSupported &&
isFeatureEnabled(serverState, flags, "documentSymbol", machineId),
documentSymbolProvider: slangSupported && documentSymbolsEnabled,
workspace: {
workspaceFolders: {
supported: false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { SemanticTokenTypes } from "vscode-languageserver-protocol";
import { NodeType, TokenNode } from "@nomicfoundation/slang/cst";
import { NodeType } from "@nomicfoundation/slang/cst";
import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds";
import { Cursor } from "@nomicfoundation/slang/cursor";
import { HighlightVisitor } from "../HighlightVisitor";
import { SlangNodeWrapper } from "../../../parser/slangHelpers";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { SemanticTokenTypes } from "vscode-languageserver-protocol";
import { NodeType, TokenNode } from "@nomicfoundation/slang/cst";
import { NodeType } from "@nomicfoundation/slang/cst";
import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds";
import { Cursor } from "@nomicfoundation/slang/cursor";
import { HighlightVisitor } from "../HighlightVisitor";
import { SlangNodeWrapper } from "../../../parser/slangHelpers";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { SemanticTokenTypes } from "vscode-languageserver-protocol";
import { NodeType, TokenNode } from "@nomicfoundation/slang/cst";
import { NodeType } from "@nomicfoundation/slang/cst";
import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds";
import { Cursor } from "@nomicfoundation/slang/cursor";
import { HighlightVisitor } from "../HighlightVisitor";
import { SlangNodeWrapper } from "../../../parser/slangHelpers";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { SemanticTokenTypes } from "vscode-languageserver-protocol";
import { NodeType, TokenNode } from "@nomicfoundation/slang/cst";
import { NodeType } from "@nomicfoundation/slang/cst";
import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds";
import { Cursor } from "@nomicfoundation/slang/cursor";
import { HighlightVisitor } from "../HighlightVisitor";
import { SlangNodeWrapper } from "../../../parser/slangHelpers";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { SemanticTokenTypes } from "vscode-languageserver-protocol";
import { NodeType, TokenNode } from "@nomicfoundation/slang/cst";
import { NodeType } from "@nomicfoundation/slang/cst";
import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds";
import { Cursor } from "@nomicfoundation/slang/cursor";
import { HighlightVisitor } from "../HighlightVisitor";
import { SlangNodeWrapper } from "../../../parser/slangHelpers";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { SemanticTokenTypes } from "vscode-languageserver-protocol";
import { NodeType, TokenNode } from "@nomicfoundation/slang/cst";
import { NodeType } from "@nomicfoundation/slang/cst";
import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds";
import { Cursor } from "@nomicfoundation/slang/cursor";
import { HighlightVisitor } from "../HighlightVisitor";
import { SlangNodeWrapper } from "../../../parser/slangHelpers";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { SemanticTokenTypes } from "vscode-languageserver-protocol";
import { NodeType, TokenNode } from "@nomicfoundation/slang/cst";
import { NodeType } from "@nomicfoundation/slang/cst";
import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds";
import { Cursor } from "@nomicfoundation/slang/cursor";
import { HighlightVisitor } from "../HighlightVisitor";
import { SlangNodeWrapper } from "../../../parser/slangHelpers";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { SemanticTokenTypes } from "vscode-languageserver-protocol";
import { TokenKind } from "@nomicfoundation/slang/kinds";
import { NodeType, TokenNode } from "@nomicfoundation/slang/cst";
import { Cursor } from "@nomicfoundation/slang/cursor";
import { NodeType } from "@nomicfoundation/slang/cst";
import { HighlightVisitor } from "../HighlightVisitor";
import { SlangNodeWrapper } from "../../../parser/slangHelpers";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { SemanticTokenTypes } from "vscode-languageserver-protocol";
import { TokenKind } from "@nomicfoundation/slang/kinds";
import { NodeType, TokenNode } from "@nomicfoundation/slang/cst";
import { Cursor } from "@nomicfoundation/slang/cursor";
import { NodeType } from "@nomicfoundation/slang/cst";
import { HighlightVisitor } from "../HighlightVisitor";
import { SlangNodeWrapper } from "../../../parser/slangHelpers";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { SemanticTokenTypes } from "vscode-languageserver-protocol";
import { TokenKind } from "@nomicfoundation/slang/kinds";
import { NodeType, TokenNode } from "@nomicfoundation/slang/cst";
import { Cursor } from "@nomicfoundation/slang/cursor";
import { NodeType } from "@nomicfoundation/slang/cst";
import { HighlightVisitor } from "../HighlightVisitor";
import { SlangNodeWrapper } from "../../../parser/slangHelpers";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { SemanticTokenTypes } from "vscode-languageserver-protocol";
import { NodeType, TokenNode } from "@nomicfoundation/slang/cst";
import { NodeType } from "@nomicfoundation/slang/cst";
import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds";
import { Cursor } from "@nomicfoundation/slang/cursor";
import { HighlightVisitor } from "../HighlightVisitor";
import { SlangNodeWrapper } from "../../../parser/slangHelpers";

Expand Down
2 changes: 0 additions & 2 deletions server/src/telemetry/SentryServerTelemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,6 @@ export class SentryServerTelemetry implements Telemetry {
return null;
} finally {
transaction.finish();
// const elapsed = transaction.endTimestamp! - transaction.startTimestamp;
// console.log(`${taskName}: ${elapsed * 1000} ms`);
}
}

Expand Down

0 comments on commit c93765e

Please sign in to comment.