Skip to content

Commit

Permalink
Fixed bug in previous suggestion filtering on web
Browse files Browse the repository at this point in the history
  • Loading branch information
elijah-potter committed Jan 22, 2024
1 parent daea731 commit 36152d2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 19 deletions.
1 change: 0 additions & 1 deletion web/src/lib/Editor.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
function calcHeight(boxContent: string): number {
let numberOfLineBreaks = (boxContent.match(/\n/g) || []).length;
let newHeight = 20 + numberOfLineBreaks * 30 + 12 + 2;
console.log(newHeight);
return newHeight;
}
</script>
Expand Down
14 changes: 8 additions & 6 deletions web/src/lib/analysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,12 @@ export function spanContent(span: Span, source: string): string {
}

export async function lintText(text: string, useWasm = defaultUseWasm): Promise<Lint[]> {
let lints;

if (useWasm) {
const wasm = await import('wasm');

const lints = wasm.lint(text);
return lints;
lints = wasm.lint(text);
} else {
const req = await fetch(`/lint`, {
method: 'POST',
Expand All @@ -97,11 +98,12 @@ export async function lintText(text: string, useWasm = defaultUseWasm): Promise<

const res: LintResponse = await req.json();

// We only want to show fixable errors.
const lints = res.lints.filter((lint) => lint.suggestions.length > 0);
console.log(lints);
return lints;
lints = res.lints;
}

// We only want to show fixable errors.
lints = lints.filter((lint) => lint.suggestions.length > 0);
return lints;
}

export async function applySuggestion(
Expand Down
12 changes: 0 additions & 12 deletions web/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -419,13 +419,6 @@
resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.9.5.tgz#10491ccf4f63c814d4149e0316541476ea603602"
integrity sha512-1q+mykKE3Vot1kaFJIDoUFv5TuW+QQVaf2FmTT9krg86pQrGStOSJJ0Zil7CFagyxDuouTepzt5Y5TVzyajOdQ==

"@sveltejs/adapter-auto@^2.0.0":
version "2.1.1"
resolved "https://registry.yarnpkg.com/@sveltejs/adapter-auto/-/adapter-auto-2.1.1.tgz#e055c71bdb8d2923d63db089752675f70ab1a0f3"
integrity sha512-nzi6x/7/3Axh5VKQ8Eed3pYxastxoa06Y/bFhWb7h3Nu+nGRVxKAy3+hBJgmPCwWScy8n0TsstZjSVKfyrIHkg==
dependencies:
import-meta-resolve "^4.0.0"

"@sveltejs/adapter-node@^3.0.0":
version "3.0.0"
resolved "https://registry.yarnpkg.com/@sveltejs/adapter-node/-/adapter-node-3.0.0.tgz#639ac5a26a6ed8efee14ed88a1bb4bab81abccb1"
Expand Down Expand Up @@ -1489,11 +1482,6 @@ import-fresh@^3.2.1:
parent-module "^1.0.0"
resolve-from "^4.0.0"

import-meta-resolve@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/import-meta-resolve/-/import-meta-resolve-4.0.0.tgz#0b1195915689f60ab00f830af0f15cc841e8919e"
integrity sha512-okYUR7ZQPH+efeuMJGlq4f8ubUgO50kByRPyt/Cy1Io4PSRsPjxME+YlVaCOx+NIToW7hCsZNFJyTPFFKepRSA==

imurmurhash@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
Expand Down

0 comments on commit 36152d2

Please sign in to comment.